After upgrading to IDEA 2016.1: ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.

Answered

My project has been working in IDEA 15, but after the upgrade to 2016.1 I get the following error when I run the project:

ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.

I do have a src/main/resources/log4j2.xml file, so I'm not sure why it's not being found.  Any ideas?

12 comments

Make sure the resources are copied to the classpath (target directory).

Attach the sample project to reproduce if the issue persists.

0

Hi,

I am also getting the same error while working on log4j2. could you please help me to resolve this issue.

Folder structure.

Error while loading log4j2 file even though the log4j2 file is placed inside resource folder 

Error:

ERROR StatusLogger No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property 'log4j2.debug' to show Log4j 2 internal initialization logging. See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2

These are the libraries I am using.

0

Hello,

Does it help if you mark "resource" directory as a "Resources Root"? Also you may try to put it under "src" folder:https://stackoverflow.com/a/25487455/2960034

0

Hi,

I have followed your instruction still same error is coming.  below I have attached sample example.

could you please check it.  I am not understanding this issue.

 

https://drive.google.com/open?id=14fyB-9T2N1I85OFwrOmXjBQX0DiMMP3G

0

Please follow these steps:

1. Unmark "TestLog" root as sources root

2. Mark "src" as sources root

3. Put "log4j2.xml" under "src" (without resources folder)

or

3. Put "resources" folder under "TestLog" root and mark it as "Resources Root"

0

Hi,

Thanks a lot. It is working fine.

Thank you for your support.

0

None of this is working for me. I've tried everything suggested in this thread, and more, and I cannot escape this:

"ERROR StatusLogger No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property 'log4j2.debug' to show Log4j 2 internal initialization logging. See https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions on how to configure Log4j 2" 

I started with a resources directory that was a sibling of my src directory, and was resources root. Doesn't work. I unset that directory, then moved it into my src directory, then reset it back to resource root. Still doesn't work. I then tried placing the log4j2.json config file in the root level of my src directory, and still, not working. 

0

Thanks, Serge, and forgive me please, but, I'm not seeing how that link is relevant to this situation? log4j is actually loading fine, it just can't find my configuration file, no matter where I put it in my project. 

 

UPDATE: after reading some of the comments in the SO question, under your answer, I think I see how it relates. Unfortunately, I'm not able to download the project you linked to in your answer there, Crazy Coder... ;-)

0

Thanks again, Serge. I had the same structure, and the only way I could get it to attempt loading was passing in -Dlog4j.configurationFile=/path... as a vm argument in the run configuration. All that said, there are additional required dependencies with log4j2 when using json as the configuration file type, which have nothing to do with intellij. Thanks again.  

0

Please sign in to leave a comment.