-
1. Re: Rolling over JBoss console log
kaobe Sep 12, 2006 6:56 AM (in response to ramdas)Hi Ramdas,
what does not work when changing the configuration of log4j.xml. Normally this is the place where you put your configuration. What have you changed and what doesn't work?
Peter -
2. Re: Rolling over JBoss console log
ramdas Sep 12, 2006 8:46 PM (in response to ramdas)Peter,
In my configuration, when JBoss starts, the console output is redirected to a file (using start_jboss.sh > console.log 2>&1).
I am trying to find a way to rollover the log file which is being created as a result of redirecting console output.
I realize that the format of the data output to the console is being influenced by the following in log4j.xml<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/> <param name="Target" value="System.out"/> <param name="Threshold" value="INFO"/> <layout class="org.apache.log4j.PatternLayout"> <!-- The default pattern: Date Priority [Category] Message\n --> <param name="ConversionPattern" value="%d %-5p [%c{1}] %m%n"/> </layout> </appender>
I tried using an element in log4j.xml similar to the one i have used for creating and rolling over the JBoss server.log. But it does not have any influence on console.log - which i think makes sense since the console.log file is not created by log4j but by my shelll script which is redirecting the console output.
I am trying to find if there is a way to capture the console output to a file and also rollover that file every day.
Thanks
Ramdas -
3. Re: Rolling over JBoss console log
kaobe Sep 13, 2006 3:31 AM (in response to ramdas)Hi Ramdas,
I'm not sure if I understand you right. But if you want to capture the output to the console in your file, why don't you change the "CONSOLE" appender in log4j.xml to use a RollingFileAppender like the "FILE" appender? Then you could remove the redirect from the shell to console.log and configure logging via log4j.
If I got you wrong, please give me some more input.
Peter -
4. Re: Rolling over JBoss console log
ramdas Sep 13, 2006 1:02 PM (in response to ramdas)Peter,
I tried your suggestion but there was no output to the log. Here is what i used:<appender name="CONSOLE" class="org.jboss.logging.appender.RollingFileAppender"/> <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/> <param name="File" value="${jboss.server.home.dir}/log/console1.log"/> <param name="Threshold" value="INFO"/> <param name="Target" value="System.out"/> <param name="Append" value="false"/> <layout class="org.apache.log4j.PatternLayout"> <!-- The default pattern: Date Priority [Category] Message\n --> <param name="ConversionPattern" value="%d %-5p [%c{1}] %m%n"/> </layout> </appender>
What am i doing wrong here?
Thanks
Ramdas -
5. Re: Rolling over JBoss console log
kaobe Sep 14, 2006 4:33 AM (in response to ramdas)Hi Ramdas,
there are some errors in your configuration. First you finish the opening appender tag with "/>". That brings a SaxParseException. Then you have the param "Target" that is not possible for the FileAppender.
Apart from that your configuration works for me.
Peter -
6. Re: Rolling over JBoss console log
ramdas Sep 14, 2006 1:49 PM (in response to ramdas)Peter,
I corrected the extra tag for the appender and removed the target - but now my output will be the same as server.log.
I am wondering, if i remove the "Target" parameter, how different is this going to be from creating the application server log. The console output captures stuff which the server.log does not - in particular JVM related messages and that is the stuff that i want to get into a file which can be rolled over.
Thanks
Ramdas -
7. Re: Rolling over JBoss console log
kaobe Sep 15, 2006 3:59 AM (in response to ramdas)Hi Ramdas,
the configuration is not different from the server.log at all.
What messages are given out on the console that do not appear in the server.log (if you have the same threshold defined)? I haven't noticed anything different yet.
Peter -
8. Re: Rolling over JBoss console log
ramdas Sep 15, 2006 12:51 PM (in response to ramdas)The output thrown to JBOSS_CONSOLE is quite different and we have noticed that when we have had JVM crashes, the JVM messages are dumped in the console output and not in server.log. If you redirect JBOSS_CONSOLE to a file instead of /dev/null, you will see the differences.
Thanks
Ramdas