-
1. Re: .yyyyMMdd.log logging format
jamezp Jul 25, 2012 11:40 AM (in response to ohmygod)It will only append the date when the file is set to rotate. In the version of JBoss Log Manager that is shipped with 7.1.x it didn't look at the file date on startup to determine when to rotate the file. You should be able to replace the library with no adverse effects.
--
James R. Perkins
-
2. Re: .yyyyMMdd.log logging format
ohmygod Jul 25, 2012 11:53 AM (in response to jamezp)Hi James,
What library do you mean can do what I required?
1. configured as filename.yyyyMMdd.log
2. for the log file in current day, it is not named without extension .log
-
3. Re: .yyyyMMdd.log logging format
jamezp Jul 25, 2012 12:12 PM (in response to ohmygod)Mike,
There is no way, at least that I can think of, to append the date to the file by default. You could extend the org.jboss.logmanager.handlers.PeriodicRotatingFileHandler and create your own handler that would append the date to the end of the current file. Then just set it up as a custom handler.
You can download the latest log manager at https://repository.jboss.org/nexus/index.html#view-repositories;releases~browsestorage~/org/jboss/logmanager/jboss-logmanager/1.3.1.Final/jboss-logmanager-1.3.1.Final.jar. Put that jar in the ${JBOSS_HOME}/modules/org/jboss/logmanager/main directory. Then edit the module.xml and change the path to the new jar.
module.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ JBoss, Home of Professional Open Source. ~ Copyright 2010, Red Hat, Inc., and individual contributors ~ as indicated by the @author tags. See the copyright.txt file in the ~ distribution for a full listing of individual contributors. ~ ~ This is free software; you can redistribute it and/or modify it ~ under the terms of the GNU Lesser General Public License as ~ published by the Free Software Foundation; either version 2.1 of ~ the License, or (at your option) any later version. ~ ~ This software is distributed in the hope that it will be useful, ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~ Lesser General Public License for more details. ~ ~ You should have received a copy of the GNU Lesser General Public ~ License along with this software; if not, write to the Free ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. --> <module xmlns="urn:jboss:module:1.1" name="org.jboss.logmanager"> <resources> <resource-root path="jboss-logmanager-1.3.1.Final.jar"/> <!-- Insert resources here --> </resources> <dependencies/> </module>
--
James R. Perkins
-
4. Re: .yyyyMMdd.log logging format
ohmygod Jul 25, 2012 12:39 PM (in response to jamezp)Thank you James, do you mean in current JBoss (7.1.1.Final) we can not create our own custom log handler using jboss-logmanager-1.2.2.GA.jar so I need to use the latest jar jboss-logmanager-1.3.1.Final.jar?
And where can the custom handler class be put so that the custom-handler can load with class attribute? Or besides class attribute, any other attributes (like module?) need to be used for this purpose? And if you can post a short of sample code for the custom handler class, it will be much appreciated.
-
5. Re: .yyyyMMdd.log logging format
jamezp Jul 25, 2012 2:04 PM (in response to ohmygod)Mike,
You can use the 1.2.2.GA version, but it will only rotate if the application server has been up for a day. Meaning if you start it today, stop it before midnight and restart tomorrow no rotating would happen. Of course you could fix that in your extended version.
This is a pretty good article on how to write and use a custom handler https://community.jboss.org/wiki/CreatingACustomLoggingHandlerInJBOSSAs710Final.
--
James R. Perkins
-
6. Re: .yyyyMMdd.log logging format
ohmygod Jul 25, 2012 2:44 PM (in response to jamezp)Thanks so much, James. I will read it carefully and have a try.