logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ajay Dhanawade" <ajaykuma...@hotmail.com>
Subject AsyncAppender creating too many threads.....
Date Tue, 04 Dec 2001 01:57:46 GMT
Hi All,

I had poste dthis question earlier as well. I am havinn problem with the 
AsyncAppender. We are trying to implement the log4j in our J2EE application. 
When we start the application and monitor we see 80 threads created whereas 
the Weblogic server 6.0sp1 which we are usinf spawns max 30 threads.

What can be wrong ? I am using log4j version 1.2. Follwoing is the config 
file for log4j

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration SYSTEM "log4j.dtd">

<configuration configDebug="false">

	<appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
	        <appender-ref ref="TEMP"/>

	<appender name="TEMP" class="org.apache.log4j.RollingFileAppender">
	    <param name="Append" value="false" />
	    <param name="Prefix" value="/bea/logs/test-" />
	    <param name="Postfix" value=".log" />
	    <param name="MaxFileSize" value="1" />
	    <param name="MaxBackupIndex" value="1" />
  		     <param name="ConversionPattern"
                            value="%d %-5p [%t] %C{2} (%F:%L) - %m\n"/>

		<priority value="debug"/>
		<appender-ref ref="ASYNC"/>

I have a designed a class to use log4j which is as follows:

import org.apache.log4j.*;
import org.apache.log4j.xml.*;
import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;

public class TracerLogger implements ITracerLogger,Serializable{
	String componentName = null;
	String sessionID = null;

	public TracerLogger(String className){
		componentName = className;

	public TracerLogger(HttpServletRequest req, String className){
		sessionID = req.getRequestedSessionId();
		componentName = className;

	public Category getCategory(){
	    AppServerCategoryFactory factory;
		factory = new AppServerCategoryFactory("MyServer", "ActionMail", 

		Category cat = AppServerCategory.getInstance(componentName);
		PatternLayout layout = new AppServerPatternLayout();
		cat.addAppender( new AsyncAppender());
		return cat;

	public void debug(String message){
		Category cat = getCategory();

	public void error(String message){
		Category cat = getCategory();

	public void info(String message){
		Category cat = getCategory();

	public void warn(String message){
		Category cat = getCategory();

	public void fatal(String message){
		Category cat = getCategory();

This class is instantiated in each and every class which logs the messages 
to a file.

Please can anyone give me pointers on what might be the cause for so many 
threads getting created?

Help is appriciated...


Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>

View raw message