Skip to content

Log4J doesn’t understand your command-line pointer to

July 26, 2012

I had to answer this question more than once, so it’s probably worth posting in case somebody else out there is looking for the answer.

Are you getting this error message when trying to run a class that uses Log4J?

log4j:WARN No appenders could be found for logger (ldif.local.Ldif$).
log4j:WARN Please initialize the log4j system properly.

Are you specifying a pointer to your file like this?

java -Xmx2G -Xms256M -Dlog4j.configuration=file:../resources/ [MainClass]

The part that most people forget is that “file:” before the path to Check that once more and try again. 🙂

If you are using IntelliJ IDEA, the place to set that is under “Run / Edit Configurations / (choose your class under Applications) / VM options”.


From → tech-tips

  1. Manolo permalink

    Thanks! It worked for me.

  2. Rohan permalink

    Thank you

  3. The syntax set JAVA_OPT=%JAVA_OPT% -Dlog4j.configuration=file:../config/
    works also in.cmd script for windows for reading the log4j configurations.

  4. Could you be more specific about what to input into IntelliJ? I tried

    java -Xmx2G -Xms256M -Dlog4j.configuration=file:../resources/ [MainClass]

    -Dlog4j.configuration=file:../resources/ [MainClass]

    java -Xmx2G -Xms256M -Dlog4j.configuration=file:../resources/

    None of these options worked.
    (I also tried the suggestion for the cmd script in windows while running my code there, and it didn’t seem to make a difference. Any suggestions are appreciated!)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: