-
1. Re: JDK 1.4+ logging instead of Log4J in JBoss7
jamezp Dec 7, 2011 12:21 PM (in response to dmrrb)1 of 1 people found this helpfuldmrrb,
You can log with just about any logging framework and JBoss Logging will pick it up and output it. Currently we don't support any other configurations other than the logging configuration that is in the standalone.xml or the domain.xml. You could easily define a handler that outputs to a file via CLI, the web interface or by updating your configuration file.
The following configuration added to the logging subsystem section in either your standalone.xml or the domain.xml will send log messages to the myFileLog.log file.
<subsystem xmlns="urn:jboss:domain:logging:1.1"> .... <file-handler name="myFileHandler"> <file relative-to="jboss.server.log.dir" path="myFileLog.log"/> <append value="true" /> </file-handler> .... <root-logger> <level name="INFO" /> <handlers> <handler name="CONSOLE" /> <handler name="FILE" /> <handler name="myFileHandler" /> </handlers> </root-logger> </subsystem>
The above will log all messages to that file. If you want to use only log your messages to the file you can add a logger with the lowest level category that you use.
<subsystem xmlns="urn:jboss:domain:logging:1.1"> .... <file-handler name="myFileHandler"> <file relative-to="jboss.server.log.dir" path="myFileLog.log"/> <append value="true" /> </file-handler> .... <logger category="com.yourcompany"> <level name="INFO" /> <handlers> <handler name="myFileHandler" /> </handlers> </logger> </subsystem>
We are how ever working on a solution where you could just add a logging.properties file in your deployment that will automatically be detected and used to configure the logger. This is not upstream yet, but work is being done on it.
-
2. Re: JDK 1.4+ logging instead of Log4J in JBoss7
dmrrb Dec 13, 2011 2:35 PM (in response to jamezp)Thanks James, I followed your approach to define a custom handler. But since the logging.properties file is not detected, that didn't work. So working on an alternative approach.
I am having following questions now.
1. What is the default logging framework used by JBoss 7? I see the below post and it hinted me it uses java util logging by default.
http://community.jboss.org/thread/156915
2. If I want to use Log4J instead how would I configure that?
Many thanks,
dmrrb
-
3. Re: JDK 1.4+ logging instead of Log4J in JBoss7
jamezp Dec 13, 2011 2:42 PM (in response to dmrrb)1 of 1 people found this helpfulHello dmrrb,
Yes, the logging.properties file will not be detected. We are working on a solution for that, but it's not in the upstream at the moment. You will currently need to define the logging configuration in the standalone.xml or the domain.xml depending on which mode you're running in.
1. We use JBoss Logging 3 in JBoss AS 7.
2. You can use log4j for your own applications, but appenders and stuff like that will not currently work for messages not logged with log4j. Again we are working on a solution for this, but it's not complete yet.
--
James R. Perkins