Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Struts - A MVC web framework
Tomcat - JSP/Servlet container
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
JSP - A mailing list about Java Server Pages specification and reference
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
Help in log4j multiple out put files

Help in log4j multiple out put files

2004-06-29       - By Manoj Mallawaarachchie

 Back




Dear All,


I have little problem with creating and separating log output to
multiple log files,

I'm trying to do the separate log out put to files, but my problem is if
do the instance one class in main program say A1.class instance A2.class

The logger define to A1.class contain A2.class es log out puts. So how
can I avoid this.

Please give me some advice to overcome this issue. I attach my source
files with this mail

Thank you,
Best regards,
Manoj


My config file
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----
#log4j.rootLogger=ALL, dest3, dest4


#Catagory
Log4j.category.dest4=INFO,dest4
Log4j.category.dest3=WARN,dest3

log4j.additivity.dest4=false
log4j.additivity.dest3=false


log4j.appender.dest4.layout=org.apache.log4j.PatternLayout
#WRITE LOG TO A FILE, ROLL THE FILE EVERY WEEK
log4j.appender.dest4=org.apache.log4j.DailyRollingFileAppender

# Specify the file name
log4j.appender.dest4.File=log2222.txt
# Control the maximum log file size
#log4j.appender.dest3.MaxFileSize=300KB

# Rollover log file at the start of each week
log4j.appender.dest4.DatePattern='.'yyyy-MM
log4j.appender.dest4.layout.ConversionPattern=%d{yyyy-MM-dd hh:mm:ss}

|%m %n
log4j.appender.dest4.Threshold=INFO


log4j.appender.dest3.layout=org.apache.log4j.PatternLayout
#WRITE LOG TO A FILE, ROLL THE FILE EVERY WEEK
log4j.appender.dest3=org.apache.log4j.DailyRollingFileAppender
# Specify the file name
log4j.appender.dest3.File=log.txt
# Control the maximum log file size
#log4j.appender.dest3.MaxFileSize=300KB
# Rollover log file at the start of each week
log4j.appender.dest3.DatePattern='.'yyyy-MM
log4j.appender.dest3.layout.ConversionPattern=%d{yyyy-MM-dd hh:mm:ss}

|%m %n
log4j.appender.dest3.Threshold=WARN
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---

******Java main program  ******

import org.apache.log4j.Logger Source code of org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator Source code of org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.Category Source code of org.apache.log4j.Category;

public class dest3 {

 // static Logger logger = Logger.getLogger(getClass());

static Category  log = Category.getInstance(dest3.class.getClass());


  public static void main(String args[]) {

     PropertyConfigurator.configure("config3.txt");


     log.warn("Here is some FATAL");

dest4 d4 = new dest4();
/* This method out put should go to second log file, but it contain  2nd
//logfile    as well as  this files(logfile 1)  too    */

d4.p();


  }
}
-- ---- ---- ---- ---- ---- ---- ----


===========================================================================
To unsubscribe, send email to listserv@(protected) and include in the body
of the message "signoff J2EE-INTEREST".  For general help, send email to
listserv@(protected) and include in the body of the message "help".


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859 (See http://ISO-8859.ora-code.com)-1">
 <title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
<table cellpadding="0" cellspacing="0" border="0" width="9" height="90">
 <tbody>
   <tr>
     <th valign="baseline" align="right" nowrap="nowrap"><br>
     </th>
     <td><br>
     </td>
   </tr>
   <tr>
     <td></td>
   </tr>
   <tr>
     <th valign="baseline" align="right" nowrap="nowrap"></th>
     <td><br>
     </td>
   </tr>
 </tbody>
</table>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859 (See http://ISO-8859.ora-code.com)-1">
<title></title>
Dear All,<br>
<br>
<br>
I have little
problem with creating and separating log output to multiple log files,<br>
<br>
I'm trying to do the separate log out put to files, but my problem is
if do the instance one class in main program say A1.class instance
A2.class <br>
<br>
The logger define to A1.class contain A2.class es log out puts. So how
can I avoid this.<br>
<br>
Please give me some advice to overcome this issue. I attach my source
files with this mail<br>
<br>
Thank you,<br>
Best regards,<br>
Manoj<br>
<br>
<br>
My config file<br>
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -----<br>
#log4j.rootLogger=ALL, dest3, dest4<br>
<br>
<br>
#Catagory<br>
Log4j.category.dest4=INFO,dest4<br>
Log4j.category.dest3=WARN,dest3<br>
<br>
log4j.additivity.dest4=false<br>
log4j.additivity.dest3=false<br>
<br>
<br>
log4j.appender.dest4.layout=org.apache.log4j.PatternLayout<br>
#WRITE LOG TO A FILE, ROLL THE FILE EVERY WEEK<br>
log4j.appender.dest4=org.apache.log4j.DailyRollingFileAppender<br>
<br>
# Specify the file name<br>
log4j.appender.dest4.File=log2222.txt<br>
# Control the maximum log file size<br>
#log4j.appender.dest3.MaxFileSize=300KB<br>
<br>
# Rollover log file at the start of each week<br>
log4j.appender.dest4.DatePattern='.'yyyy-MM<br>
log4j.appender.dest4.layout.ConversionPattern=%d{yyyy-MM-dd hh:mm:ss} <br>
<br>
|%m %n<br>
log4j.appender.dest4.Threshold=INFO<br>
<br>
<br>
log4j.appender.dest3.layout=org.apache.log4j.PatternLayout<br>
#WRITE LOG TO A FILE, ROLL THE FILE EVERY WEEK<br>
log4j.appender.dest3=org.apache.log4j.DailyRollingFileAppender<br>
# Specify the file name<br>
log4j.appender.dest3.File=log.txt<br>
# Control the maximum log file size<br>
#log4j.appender.dest3.MaxFileSize=300KB<br>
# Rollover log file at the start of each week<br>
log4j.appender.dest3.DatePattern='.'yyyy-MM<br>
log4j.appender.dest3.layout.ConversionPattern=%d{yyyy-MM-dd hh:mm:ss} <br>
<br>
|%m %n<br>
log4j.appender.dest3.Threshold=WARN<br>
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---<br>
<br>
******Java main program&nbsp; ******<br>
<br>
import org.apache.log4j.Logger Source code of org.apache.log4j.Logger;<br>
import org.apache.log4j.PropertyConfigurator Source code of org.apache.log4j.PropertyConfigurator;<br>
import org.apache.log4j.Category Source code of org.apache.log4j.Category;<br>
<br>
public class dest3 {<br>
<br>
&nbsp; // static Logger logger = Logger.getLogger(getClass());<br>
<br>
static Category&nbsp; log = Category.getInstance(dest3.class.getClass());<br>
<br>
<br>
&nbsp;&nbsp; public static void main(String args[]) {<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PropertyConfigurator.configure("config3.txt");
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log.warn("Here is some FATAL");<br>
<br>
dest4 d4 = new dest4(); <br>
/* This method out put should go to second log file, but it contain&nbsp;
2nd //logfile&nbsp;&nbsp;&nbsp; as well as&nbsp; this files(logfile 1)&nbsp;
too&nbsp;&nbsp;&nbsp; */<br>
<br>
d4.p();<br>
<br>
<br>
&nbsp;&nbsp; }<br>
}<br>
-- ---- ---- ---- ---- ---- ---- ----<br>
<br>
<small><small><span
style="font-weight: bold; font-size: 14pt; font-family: arial,helvetica,sans
-serif;">
</span></small></small>
</body>
</html>
===========================================================================
To unsubscribe, send email to listserv@(protected) and include in the body
of the message "signoff J2EE-INTEREST".  For general help, send email to
listserv@(protected) and include in the body of the message "help".
<p>

©2008 junlu.com - Jax Systems, LLC, U.S.A.