Custom log categories in Plugins " is not a class name or namespace " UE_LOG compile error

I used to have code on my project.
Now I moved all to a plugin inside the Plugins/ folder of the project with its subsecuent changes needed.

I Have a definition of a custom log category on the Module .h and .cpp of my plugin. Before moving files, this category was defined on the main projectName.h, as usual.

On the .h

On the .cpp

The rest of the files inside the sources folders (Private, Public) seem to not need the inclussion of “PluginNameModule.h” on every file… (seems like it).
But all the UE_LOGS are now failing. They all say that the LogCategory defined (LOG_NAME) is not a class name or a namespace. And other errors follow.

What’s the best practice here when you are working on a plugin? I saw other plugins and none of them seem to include the module base .h to any file…

I fixed this by including the base header file of the module, which contains the log declaration. But this seems weird, I thought this declaration was general for the whole project


Hi @darkgaze, did you find a better way to defined a log category in a plugin since ?

EDIT: Ok including the header file which declare the log category seems to be the standard way (Issue Declaring Log Category - UE4 AnswerHub). Then I took my inspiration from Engine\Source\Runtime\AIModule\Private\AIModuleLog.h, just 1 dedicated file for my log categories I can include without extra code.