First of all I need to say that I’m newbie in Java and Java-related technologies.
Recently I got a big project in Java. It has client and server sides. When I’m trying to call client-side application, it gives me following warning:
`log4j:WARN No appenders could be found for logger (org.jboss.security.SecurityAssociation).
log4j:WARN Please initialize the log4j system properly.`
Ok, it seems like log4j can’t find its properties file. I didn’t find any, so I wrote a new one:
log4j.rootLogger=info, stdout, file
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.file=server.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n`
And now I have no idea where I have to put it. Documentation says, that it has to be in classpath – so I tried to put it into /src/ subdirectory of client, web and webinfo folders. I also tried the root folder of project – but it keeps giving me warnings.
Does anybody know good manual on “How to find a place to put log4j.properties file” topic? Or maybe I have to write somewhere in jboss configuration files that I’m using the following log4j.properties file?
You can configure
log4j propertiesin different ways,classpath, For any web application default classpath would beWEB-INF/classes, You can placelog4j.propertiesfile there. If it is not web application, try to find where all your classes resides, usually insidebinfolder.VM args-Dlog4j.configuration=file:/C:/testing/mylog4j.properties