Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log file creation in jboss

 
A KCR
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 1.13.2.8 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"/>
-->
</layout>
</appender>

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

</log4j:configuration>
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
Ambarish
[ March 10, 2004: Message edited by: A KCR ]
 
norman richards
Author
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Norman
Is there anyway i can define application specific logging instead of touching the global conf/log4j.xml in jboss?
Thanks in advance
Ambarish
 
norman richards
Author
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The normal way is to define your appenders and categories in log4j.xml.
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic