The moose likes JBoss/WildFly and the fly likes Can't figure out why my log4j.log file isn't being populated Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Can Watch "Can New topic

Can't figure out why my log4j.log file isn't being populated

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436

I'm using JBoss 4.2.3.GA (can't change this), and log4j 1.2.15. I have deployed an EAR file to JBoss containing

In "myclient.jar", I have a class with this

Sadly my log message doesn't appear and I can't figure out why. Here's my log4j.properties file ...

I have verified that the parent directory exists. Any ideas why nothing is showing up in my log file? Any other ideas on how to troubleshoot this? The JBoss server log tells me the EAR got deployed successfully.

Thanks, - Dave
Guillaume Jourdan
Ranch Hand

Joined: Jul 24, 2012
Posts: 47

Your static method (or static block) is called only the first time you refer to your class (by the class loader) else your static method (or block) is never called.

Do you have a reference to this class when you deploy your application?
Peter Johnson

Joined: May 14, 2008
Posts: 5812

The standard way of configuring logging in 4.2.3 is to modify the server/xxx/config/jboss-log4j.xml file. Logging config files within your EAR or WAR will not be picked up.

Also, have you seen this: https://community.jboss.org/message/198691#198690

JBoss In Action
It is sorta covered in the JavaRanch Style Guide.
subject: Can't figure out why my log4j.log file isn't being populated
Similar Threads
New to log4j concept-log messages are not appending to logfile
log4j: Why aren't I seeing output in my log file?
log4j.properties: FileNotFoundException
Log4j Log is not created when jar file run
log4j: Logger does not log