Some my observations. It seems to me as i saw when debugging webapp, that my log4j.properties are not picked up and logger
i retrieve gets appenders from JBoss, so it puts all log messages to server.log and console, but not to my myapp.html log file.
Can anybody help me to solve this problem?
I've read this wiki and i've done all accordingly to scoped logging to use my log4j.properties. Results i've got as in reply above. My question is how to log with commons-logging. When i log directly with log4j logger like:
it works. I need to log with commons-logging like:
In wiki i have not found anything about logging with commons-logging.
Any reply can be helpfull for me, thanks.
Are you by any chance including the commons logging jar file in your WEB-INF/lib directory? If so, try removing it and see if that solves the problem. I used to use commons logging all the time in my applications and never had a problem getting my logging output from JBoss.
In my case removing commons logging jar file from WEB-INF/lib directory doesn't solve the problem. Do you specify your appenders in JBoss log4j xml configuration file?
Yes I, specify my appenders in the JBoss log4j xml configuration file.
Hi, PeterJ. If you define your appeners in JBoss log4j configuration file, how do you separate logs among your apps. Do you specify
so classes in package com.myapp1.* log with Appender1 and classes in com.myapp2.* log with Appender2? I can not do so, as my diffrent apps classes in packeges with the same name com.myapp.*.
Or do you use TCLFilter to filter apps by deploymentURL while logging (i have not even got it work with this filter)? Also i really want to keep my log4j properties in my own file, so user can easily adjust this settings without touching JBoss configuration.
I've found not so pretty solution how to force classloader to pick my own log4j.properties. I put implemenatation of Log4JLogger in my package e.c. com.myapp.Log4JLogger and added to commons-logging.properties line:
Maybe someone could help me to find more correct solution?
That is all you can do if you are relying on configuration of singletons automatically finding a local configuration based on the class loader. A patch to the commons-logging to allow for more dynamic discovery of the logger factory is in the works. See http://jira.jboss.com/jira/browse/JBAS-2933
For the work that I do, logging to the server.log is no problem for me, so I have not tried to separate the logging out to other files.
The main reason for my suggestion regarding the commons logging file location was the possibility that you are running into a class loader issue, which seems to be confirmed by your latest message. But after thinking about it some more, maybe I should have suggested that you put the commons logging jar file into your WEB-INF/lib directory.
By the way, one way of debugging a cloass loader issue is add the -verbose:class JVM option to the command line. The JVM will then tell you for each class loaded what jar file it came from.