-
1. Re: AS7 Logging configuration
prasad.deshpande Aug 12, 2011 11:06 AM (in response to prasad.deshpande)anyone.. any suggestion?
-
2. Re: AS7 Logging configuration
jaikiran Aug 12, 2011 11:19 AM (in response to prasad.deshpande)LogFactory is apache commons logging? Can you attach app reproducing this?
-
3. Re: AS7 Logging configuration
prasad.deshpande Aug 12, 2011 11:59 AM (in response to jaikiran)I can't reproduce this issue on it's own, but just noticed one thing, I had this jboss-log4j.xml from AS5 & that used to work. Any reference to migrate that part to AS7?
if I remove log4j.jar from classpath, then it logs into the file, but I can't change my application at teh moment. Any ideas?
-
4. Re: AS7 Logging configuration
jaikiran Aug 15, 2011 11:57 PM (in response to prasad.deshpande)Prasad Deshpande wrote:
but just noticed one thing, I had this jboss-log4j.xml from AS5 & that used to work. Any reference to migrate that part to AS7?
Did you miss posting the jboss-log4j.xml snippet that you might be talking about?
Prasad Deshpande wrote:
if I remove log4j.jar from classpath, then it logs into the file, but I can't change my application at teh moment. Any ideas?
I'm not too sure what's going on. But maybe it's falling back on log4j and not finding the log4j.xml or log4j.properties in the classpath of the application and hence not logging anything.
-
5. Re: AS7 Logging configuration
prasad.deshpande Aug 16, 2011 6:36 AM (in response to jaikiran)Here is the log4j.xml that is used in AS5.1. I've just stripped of "jboss-" infront of the name. I tried to put his one in ear classpath/standalone/lib, doesn't help either way.
Category I'm talking here about is
<logger name="webXMLDocument" additivity="false">
<level value="DEBUG"/>
<appender-ref ref="XMLFILE"/>
</logger> Now, I know that there are 2 things here, one, Logging subsystem in standalone.xml & another is log4j.xml. Is there any way to just place this log4j.xml in application/jboss classpath & make it work?
-
log4j.xml 15.3 KB
-
-
6. Re: AS7 Logging configuration
prasad.deshpande Aug 16, 2011 12:15 PM (in response to jaikiran)At last I managed to reproduce problem that I was facing, just deploy this attached ear file & access following url. http://localhost:8080/startup/StartupServlet
I've defined logging conf in standalone.xml as follows:
<periodic-rotating-file-handler name="XMLFILE" autoflush="true"> <level name="DEBUG"/> <formatter> <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/> </formatter> <file relative-to="jboss.server.log.dir" path="efp-xml.xml"/> <suffix value=".yyyy-MM-dd"/> </periodic-rotating-file-handler> <logger category="webXMLDocument"> <level name="DEBUG"/> <handlers> <handler name="XMLFILE"/> </handlers> </logger> defined logger category can not be used in application unless I put log4j.xml in the classpath of application.
My question is How do I use logging configuration defined in standalone.xml without changing code (I don't want to put log4j.xml in application as I want to define loggers in standalone.xml)?
-
TestServlet.java.zip 533 bytes
-
a.ear 475.8 KB
-
-
7. Re: AS7 Logging configuration
jaikiran Aug 18, 2011 5:29 AM (in response to prasad.deshpande)Prasad Deshpande wrote:
defined logger category can not be used in application unless I put log4j.xml in the classpath of application.
My question is How do I use logging configuration defined in standalone.xml without changing code (I don't want to put log4j.xml in application as I want to define loggers in standalone.xml)?
I don't think that's possible. Each logging implementation like log4j expects its own configuration file to be available for configuring logger. I don't think you can configure those categories in the jboss-logging.xml and let log4j pick those configurations from there. You'll need a log4j.xml or log4j.properties. However, I'm not logging expert so I might be wrong.
-
8. Re: AS7 Logging configuration
oourfali Nov 21, 2011 7:37 AM (in response to jaikiran)I looked at this discussion, and some other discussions as well, in order to understand how I can make my configuration from EAP5 (jboss-log4j.xml file in the conf directory) in AS7.
Is there any way to do that?
-
9. Re: AS7 Logging configuration
prasad.deshpande Nov 21, 2011 7:51 AM (in response to oourfali)The way I did was, convert jboss-log4j.xml to log4j.xml/log4j.properties (you may just rename it if the format is same) & then make your XML avaialbe to your application by putting it in your application classpath with log4j jars & application will pick up your defined loggers in log4j.xml.
Please note, there is no connection between what you defined in standalone.xml & log4j.xml, so don't expect loggers to be available to application by defining in standalone.xml.
-
10. Re: AS7 Logging configuration
oourfali Nov 21, 2011 8:08 AM (in response to prasad.deshpande)So the format is different between the versions?
Just taking the same configuration (renaming it, of course) won't wotk?
-
11. Re: AS7 Logging configuration
prasad.deshpande Nov 21, 2011 8:11 AM (in response to oourfali)In most cases it should work simply by renaming & adding to application classpath. But worth cross checking..
-
12. Re: AS7 Logging configuration
oourfali Nov 21, 2011 8:34 AM (in response to prasad.deshpande)My application is deployed as an EAR.
I tried to put the log4j jar and the log4j.xml file in EAR/lib and it didn't work.
I'll keep on trying, but if you have any ideas let me know.
Thank you very much.
Oved
-
13. Re: AS7 Logging configuration
prasad.deshpande Nov 21, 2011 8:38 AM (in response to oourfali)the most obvious thing to miss is package log4j.xml in a JAR. Classloader won't pick log4j.jar on it's own... I think you can create a simple jar with log4j.xml at the root of it..