jQuery in Action, 3rd edition
The moose likes JBoss/WildFly and the fly likes log file creation in jboss Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "log file creation in jboss" Watch "log file creation in jboss" New topic

log file creation in jboss


Joined: Mar 10, 2004
Posts: 1
hi all,
i have problem in creating the log file on jboss home dir/log folder. i have log4j.xml as given below
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<!-- $Id: log4j.xml,v 2003/09/23 14:16:27 slaboure Exp $ -->
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
<!-- A time/date based rolling appender -->
<appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="File" value="${jboss.server.home.dir}/log/server.log"/>
<param name="Append" value="false"/>
<!-- Rollover at midnight each day -->
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<!-- Rollover at the top of each hour
<param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
<layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
<param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
<!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
<param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>

<!-- ======================= -->
<!-- Setup the Root category -->
<!-- ======================= -->
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>

I have this log4j.xml in my war file WEB-INF and even in WEB_INF/classes.
what i require is, a log file must be created when i hot deploy my war file in jboss.
Give me suggestion on all aspects, if this not workable then tell me it's not possible.
plz do suggest at the earliest as possible. If it lengthy method plz give exapmle war file and procedure to go about.
Thankz in advance
[ March 10, 2004: Message edited by: A KCR ]
norman richards
Ranch Hand

Joined: Jul 21, 2003
Posts: 367
The biggest thing I notice is that you don't define a CONSOLE appender...
Why don't you start with the log4j.xml provided by JBoss? It will do what you want. You can cut out parts when you are sure you understand what they are doing...
Ambarish Khannaa

Joined: Mar 10, 2004
Posts: 2
Thanks Norman
Is there anyway i can define application specific logging instead of touching the global conf/log4j.xml in jboss?
Thanks in advance
norman richards
Ranch Hand

Joined: Jul 21, 2003
Posts: 367
The normal way is to define your appenders and categories in log4j.xml.
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 567
I was looking through the JBoss archives and I saw a thread discussing this theme. You can configure log4j to use a seperate config file for your application. I don't recall the details but it involves setting up a log4j initialization class in your app's start-up.

I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
I agree. Here's the link: http://aspose.com/file-tools
subject: log file creation in jboss
It's not a secret anymore!