# Where do I put: DECLARE\_LOG\_CATEGORY\_EXTERN?

**URL:** <https://forums.unrealengine.com/t/where-do-i-put-declare-log-category-extern/302371>\
**Category:** C++\
**Tags:** logging, unreal-engine, question, CPP\
**Created:** [December 23, 2014, 11:55pm UTC](https://forums.unrealengine.com/t/where-do-i-put-declare-log-category-extern/302371 "2014-12-23T23:55:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Belven](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Belven](https://forums.unrealengine.com/u/Belven)\
**Post date:** [December 23, 2014, 11:55pm UTC](https://forums.unrealengine.com/t/where-do-i-put-declare-log-category-extern/302371/1 "2014-12-23T23:55:30Z")

</div>

Hi guys, I’ve been trying to set up custom logging and I’ve been trying to use this as a guide:

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

The issue is this doesn’t work for me. I’ve tried putting the custom category in like this:

```
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.

#ifndef __THE_BATTLE_OF_MALDON_H__
#define __THE_BATTLE_OF_MALDON_H__

#include "EngineMinimal.h"

DECLARE_LOG_CATEGORY_EXTERN(CombatDecisions, Log, All)
DECLARE_LOG_CATEGORY_EXTERN(CombatCombos, Log, All)
#endif

```

This fails and the complier has no idea what it is. I’ve also tried putting it straight into the .h of the classes that will be using it and same errors.

Could someone show me an example of exactly where it needs to be in code?

I also need to use DEFINE\_LOG\_CATEGORY within the .cpp so that would be great to know as well?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a6092ea3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a6092ea3](https://forums.unrealengine.com/u/anonymous_user_a6092ea3)\
**Post date:** [September 3, 2015, 9:48pm UTC](https://forums.unrealengine.com/t/where-do-i-put-declare-log-category-extern/302371/2 "2015-09-03T21:48:13Z")

</div>

They wiki page you linked describes where the code goes, so they must have updated it since this question was asked… This is an older post, but I’ll quickly answer here in case people find this through a search like me:

If you project is called MyGame, do the following:

In MyGame.h

```
DECLARE_LOG_CATEGORY_EXTERN(MyLogCat, Log, All);

```

and in MyGame.cpp

```
DEFINE_LOG_CATEGORY(MyLogCat);

```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a4ea03db1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a4ea03db1](https://forums.unrealengine.com/u/anonymous_user_a4ea03db1)\
**Post date:** [May 5, 2018, 4:08am UTC](https://forums.unrealengine.com/t/where-do-i-put-declare-log-category-extern/302371/3 "2018-05-05T04:08:52Z")

</div>

To add onto this, if you’ve defined custom logs, you need to include the base header to use them

---

<div class="post-metadata">

**Author:** ![BonecrusherOEF](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BonecrusherOEF](https://forums.unrealengine.com/u/BonecrusherOEF)\
**Post date:** [June 6, 2022, 6:26am UTC](https://forums.unrealengine.com/t/where-do-i-put-declare-log-category-extern/302371/4 "2022-06-06T06:26:13Z")

</div>

What is the “base header”? Like MyProject.h?
