You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Sumitha Arjunan <Su...@lntinfotech.com> on 2011/12/08 06:42:45 UTC
reg individual log files for each request
Hi,
In our application, we have to write the logs into different log files based on the reference number in the file.
For example suppose my file FileSample.txt is having reference 1123 , then the log file name should be ref1123.txt and whenever it come across the same reference, it has to write into the same file.
If the subsequent request deals with some other reference(4456) number it has to write the logs into the ref4456.txt.
Please let me know how can I implement this functionality.
Sumiarjun
________________________________
The contents of this e-mail and any attachment(s) may contain confidential or privileged information for the intended recipient(s). Unintended recipients are prohibited from taking action on the basis of information in this e-mail and using or disseminating the information, and must notify the sender and delete it from their system. L&T Infotech will not accept responsibility or liability for the accuracy or completeness of, or the presence of any virus or disabling code in this e-mail"
*************************************************************************
This email and attachments have been scanned for
potential proprietary or sensitive information leakage.
Websense Data Security, Protecting Your Information from the Inside Out.
www.websense.com
*************************************************************************
______________________________________________________________________
AW: reg individual log files for each request
Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
We do the same.
In our web service we have long lasting sessions, that is to say each users session request ends at the same session thread related object,
which an instance of a web service class.
Now the session context delivers the uniqe number, an id, and that object has a session logger, and the name of a unique session log file is given.
happy study
Josef
/*
* SpTestServer.java
*
* Created on 26. Juni 2007, 15:46
* Modified on
*/
package axawl.spezpla.servers.SpezplaService;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ServiceGroupContext;
import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.context.OperationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.SessionContext;
import org.apache.axis2.deployment.FileSystemConfigurator;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axiom.soap.impl.llom.soap12.SOAP12Factory;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPHeader;
import org.apache.axiom.soap.SOAPHeaderBlock;
import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPFault;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMText;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
import org.apache.axiom.om.xpath.AXIOMXPath;
import javax.xml.namespace.QName;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import javax.xml.stream.XMLStreamException;
import org.jaxen.JaxenException;
import java.util.*;
import java.util.List;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.text.*;
// this is WSIT part-stuff-code-----------
import java.io.*;
import com.hp.wsi.*;
import com.hp.wsi.WsiException;
import javax.xml.rpc.holders.*;
import java.util.HashMap;
import axawl.spezpla.servers.SPg.ISPg;
import axawl.spezpla.servers.SPg.SPgImpl;
import org.omg.PortableInterceptor.USER_EXCEPTION;
/**
* the commons logging components
***/
// the wrapper around the logger
//import org.apache.commons.logging.Log;
//import org.apache.commons.logging.LogFactory;
//import org.apache.commons.logging.impl.Jdk14Logger;
// the underlying logger system ....
// import java.util.logging.*;
// import java.util.logging.LogManager;
// import java.util.logging.FileHandler;
// .... OR .... the other underlaying logger system
import org.apache.log4j.*;
import org.apache.log4j.Logger;
import org.apache.log4j.LogManager;
import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.FileAppender;
import org.apache.log4j.net.SocketHubAppender;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
*
* @author C770817 (Josef Stadelmann)
*/
public class SpServer {
private String OperatingSystem = System.getProperty("os.name");
//private static final Log logg = LogFactory.getLog(SpTestServer.class.getName().toString());
// using static all objects of class SpTestServer share the common log variable
// this here is called once or twice when SpezplaService.aar gets deployed
// by the axis2 engine - that is when .aar gets copied into the .service dir
private static String MyLogDir = System.getProperty("user.home");
// returns MyLogDir as "/apache$root/000000"
// SEE and CONSULT the AXIS2 HAPPY PAGE under
// http://alpha1:8080/axis2/axis2-web/HappyAxis.jsp
// very carefully to see all the defaults used by AXIS2
// then study the 4 examined sections and the info they return to you to make you happy
// Examining System Properties shows
// user.dir and user.home is is set to /apache$root/000000 --- you get it --- it is the home dir
// of your tomcat application server executed by a JVM --- so you need a different technic to get
// the home dir for the user doing the axis2 SpezplaService request --- capito --- sepp
//
// dito for catalina.home and catalina.base pointing to /dsa5/apache/jakarta/tomcat/
//
//**************************************************************************
// commons-logging
//**************************************************************************
// we use common-loggings - first - we need a LogFactory used to create *** log instances ***
// http://commons.apache.org/logging/apidocs/org/apache/commons/logging/package-summary.html
// hwt to determin the LogFactory class and make use of it
// 1. checks for a system property named org.apache.commons.logging.LogFactory
// 2. used the JDK 1.3 JAR Services Discovery mechanism to look for a resource named
// META-INF/services/org.apache.commons-logging.LogFactory (first line assumed to have class name of LogFactory)
// 3. looks for properties file named commons-loggin.properties visible in the application class path with
// a property called org.apache.commons.logging.LogFactory
// 4. falls back to default impementation
//
private static Logger rlog = Logger.getRootLogger(); // shared among ....
//never use static if variable shall become an instance of ... and not be shared among ...
private Logger clog = null; // keeps the configured-logger
private Logger slog = null; // keeps the session-logger
private Logger log = null; // keeps the local copy of the session-logger
private String NameOfLogger = null; // keeps the session oriented NameOfLogger
private FileAppender sfapp = null; // keeps the session file appender simply for close()
private SocketHubAppender ssapp = null; // the socket appender to send log events to Chanisaw
// keeps the instance of a WSIT Java Bean used to communicate with our Spezpla server
private SPgImpl SPg = null;
private int i = -1; // -1
private Integer intObj = new Integer(i); // -1
// get the instance date-time (get time-stamp when this web-service is born)
// get the time/date when the object of class SpTestServer is created
private String oDate = new Date().toString();
private ServiceContext sc = null;
private OperationContext oc = null;
public void SpServer() {
//rlog.info("SpTestServer.ctor() object created @" + this.hashCode());
}
public void init(ServiceContext sCtx) throws XMLStreamException, WsiException {
// sCtx = Service Context is the ident for the session instance
this.sc = sCtx;
try {
System.out.println(OperatingSystem);
String scID = SpServer.class.getName().toString();
System.out.println("scID "+scID);
//String[] a1 = scID.split("."); does not work with "." as separator
String[] a1 = {"axawl", "spezpla", "servers", "SpezplaService", "SpServer"};
System.out.println("a1[0] "+a1[0]);
System.out.println("a1[1] "+a1[1]);
System.out.println("a1[2] "+a1[2]);
System.out.println("a1[3] "+a1[3]);
System.out.println("a1[4] "+a1[4]);
String lcID = this.sc.getLogCorrelationIDString();
System.out.println("lcID "+lcID);
String[] a2 = lcID.split("@");
System.out.println("a2[0] "+a2[0]);
System.out.println("a2[1] "+a2[1]);
//PropertyConfigurator.configureAndWatch( "/axcls/log4j.properties", 60*1000 );
// get the configured logger (known name)
// the configured logger has
// an appender of some type which knows a logfile
// an layout, a pattern, some additivitie
this.NameOfLogger = SpServer.class.getName();
System.out.println(this.NameOfLogger);
this.clog = Logger.getLogger(this.NameOfLogger);
if (clog==null) {
System.out.println("clog is null");
} else {
System.out.println("clog is NOT null");
}
Level level = this.clog.getLevel();
if (level==null) {
System.out.println("level is null");
level = Level.toLevel("INFO");
System.out.println("level is "+level.toString());
this.clog.setLevel(level);
} else {
System.out.println("level is NOT null but is "+level.toString());
}
// create the session logger
this.slog = Logger.getLogger(this.NameOfLogger.concat("@").concat(a2[1]));
this.slog.setLevel(this.clog.getLevel());
System.out.println("this.slog.Level="+this.slog.getLevel().toString());
this.slog.setAdditivity(this.clog.getAdditivity());
// get the configured appender
FileAppender cfapp = (FileAppender)this.clog.getAppender("AX_FAP");
if (cfapp != null) {
String clogFileName = cfapp.getFile(); // get the filename
int substringindex = clogFileName.indexOf(".log"); // index to ".log""
String sCxLogFileName = clogFileName.substring(0,substringindex); // extract configured prefix
sCxLogFileName = sCxLogFileName.concat("_").concat(a2[1]).concat(".log"); // make session logfilename
// create a new session appender of type FileAppender
this.sfapp = new FileAppender( cfapp.getLayout(), sCxLogFileName, cfapp.getAppend() );
// sfapp.activateOptions();
// finally add the session-appender to the session-logger
this.slog.addAppender( this.sfapp );
}
// for CHAINSAW Logging
SocketHubAppender sapp = (SocketHubAppender)this.clog.getAppender("AX_CHAINSAW");
if (sapp != null) {
// create a new session appender of type SocketAppender
//this.ssapp = new SocketAppender(sapp.getRemoteHost(),sapp.getPort());
//this.ssapp = new SocketHubAppender(sapp.getPort());
//this.ssapp.setLocationInfo(sapp.getLocationInfo());
//ssapp.activateOptions();
//this.slog.addAppender( this.ssapp);
this.slog.addAppender(sapp);
// just use the configured appender CHAINSAW_AXIS2 SocketHubAppender
// but do not create a new one with the same port .... :(
}
// for later in other methods we need
this.log = this.slog;
// take a local copy to be used in this method only
Logger log = this.slog; // create a local copy
String sDate = new Date().toString();
log.info(" init() called at : "+ sDate + " using "+ this.sc.toString()+" i="+intObj.toString(i+=1));
log.info(" ---------------------------------------------------");
log.info(" Logger is of type : "+ Logger.class.toString());
log.info(" Logger is instance : "+ log.toString());
log.info(" Logger is named : "+ log.getName());
log.info(" Logger is at level : "+ log.getLevel());
log.info(" ---------------------------------------------------");
this.SPg = null; // doubble moppel - we need it null to call login twice for vms debugging
log.info("******************************************************************************");
log.info("We are testing all log.levels here running on a "+OperatingSystem+" System");
log.fatal("test of this.log.fatal() Logger-Name "+log.getName());
log.error("test of this.log.error() Logger-Name "+log.getName());
log.warn("test of this.log.warn() Logger-Name "+log.getName());
log.info("test of this.log.info() Logger-Name "+log.getName());
log.debug("test of this.log.debug() Logger-Name "+log.getName());
log.info("can you see all FATAL ERROR WARN INFO DEBUG messages?\n");
log.info("NOTE: DEBUG messages are only shown if level = debug!\n");
log.info("******************************************************************************\n");
// erst wenn alle loggers initialisiert sind darf man sie brauchen sonst knallts
MessageContext msgCtx = MessageContext.getCurrentMessageContext();
HttpServletRequest request = (HttpServletRequest) msgCtx.getProperty("transport.http.servletRequest");
HttpSession session = request.getSession(true);
if(session.isNew()){
this.log.info("SpServer.init() called and session IS NEW *********");
} else {
this.log.info("SpServer.init() called and session IS NOT NEW *****");
}
/*
* There are various types of exceptions that you can catch here,
* including:
* WsiConnectException = Out-of-Process Connection error
* WsiServerException = Application Server (back-end) based error
* WsiException = Generic WSIT based error
* Java Exception should only be used as a catch all.
} catch (WsiConnectException wcex) {
wcex.printStackTrace();
this.log.error("Exception took place during connection to out-of-Process application server.");
} catch (WsiServerException wsex) {
wsex.printStackTrace();
this.log.error("Exception took place within application server.");
} catch (WsiException wsitex) {
wsitex.printStackTrace();
this.log.error("Unknown WSIT exception took place within the client.");
*/
} catch (Exception ex) {
ex.printStackTrace();
log.error("Unknown Java exception took place within the SpezplaService.");
}
}
public void destroy(ServiceContext sCtx) throws XMLStreamException, WsiException {
Logger log = this.log;
String sDate = new Date().toString();
log.info("SpServer.destroy() called at : "+ sDate + " using "+ this.sc.toString()+" i="+intObj.toString(i+=1));
if( this.sfapp != null )
this.sfapp.close();
if( this.ssapp != null )
this.ssapp.close();
this.sc = null;
}
. . . . . . . much more . . . . .
private void logSoapDataIN(String soapData) {
// return from call if we are not at debug level or trace or all
if (this.log.getLevel() != null) {
if (this.log.getLevel().toInt() <= Level.DEBUG_INT) {
String remain = null;
int CHUNKSIZE = 100;
int LAENGE = soapData.toString().length();
if (LAENGE < CHUNKSIZE) {
this.log.debug(" input to SPg-legacy:" + soapData);
} else {
int max = LAENGE, chunk = CHUNKSIZE;
this.log.debug(" input to SPg-legacy:");
for (int end = chunk; end < max; end += chunk) {
int beg = end - chunk;
String substr = soapData.substring(beg, end);
remain = soapData.substring(end, max);
this.log.debug(substr);
}
this.log.debug(remain);
}
}
}
}
private void logSoapDataOUT(String soapData) {
// return from call if we are not at debug level or trace or all
if (this.log.getLevel() != null) {
if (this.log.getLevel().toInt() <= Level.DEBUG_INT) {
String remain = null;
int CHUNKSIZE = 100;
int LAENGE = soapData.toString().length();
if (LAENGE < CHUNKSIZE) {
this.log.debug(" output to SPg-legacy:" + soapData);
} else {
int max = LAENGE, chunk = CHUNKSIZE;
this.log.debug(" output to SPg-legacy:");
for (int end = chunk; end < max; end += chunk) {
int beg = end - chunk;
String substr = soapData.substring(beg, end);
remain = soapData.substring(end, max);
this.log.debug(substr);
}
this.log.debug(remain);
}
}
}
}
}
So we are allowed to configure appenders, use it, and fine trim on a per object-base certain things like a file name.
log4j.debug=true
# -------------------------------------------------------------------
# Copyright 2001-2004 The Apache Software Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -------------------------------------------------------------------
# -------------------------------------------------------------------
# Set root category priority to INFO and its only appender to CONSOLE.
#log4j.rootLogger=DEBUG, AX_CONS, AX_ROLF, AX_FAP, AX_CHAINSAW
log4j.rootLogger=INFO, CONSOLE
# in absence of a true TC_CONSole - the log goes into
# apache$specific:[000000]APACHE$JAKARTA_SERVER_OUTPUT.LOG
# -------------------------------------------------------------------
#- Set your loggers priority to what you need -----------------------
# Logger logging WHAT it logs WHO is actually logging
log4j.logger.org.apache.catalina=DEBUG, TC_CONS, TC_ROLF, TC_FAP, TC_CHAINSAW
log4j.logger.org.apache.coyote=DEBUG, TC_CONS, TC_ROLF, TC_FAP, TC_CHAINSAW
log4j.logger.org.apache.jasper=DEBUG, TC_CONS, TC_ROLF, TC_FAP, TC_CHAINSAW
log4j.logger.org.apache.jk=DEBUG, TC_CONS, TC_ROLF, TC_FAP, TC_CHAINSAW
log4j.logger.org.apache.tomcat=DEBUG, TC_CONS, TC_ROLF, TC_FAP, TC_CHAINSAW
log4j.logger.org.apache.commons=DEBUG, TC_CONS, TC_ROLF, TC_FAP, TC_CHAINSAW
log4j.logger.org.apache.commons.httpclient=INFO, TC_CONS, TC_ROLF, TC_FAP, TC_CHAINSAW
log4j.logger.de.hunsicker.jalopy.io=FATAL, TC_CONS, TC_ROLF, TC_FAP, TC_CHAINSAW
log4j.logger.httpclient.wire.header=FATAL, TC_CONS, TC_ROLF, TC_FAP, TC_CHAINSAW
# -------------------------------------------------------------------
# define the additivities used to prevent logging twice the same msg
# NOTE: each logger needs an additivity set or you risk logging twice
#
log4j.additivity.org.apache.catalina=false
log4j.additivity.org.apache.coyote=false
log4j.additivity.org.apache.jasper=false
log4j.additivity.org.apache.jk=false
log4j.additivity.org.apache.tomcat=false
log4j.additivity.org.apache.commons=false
log4j.additivity.org.apache.commons.httpclient=false
log4j.additivity.de.hunsicker.jalopy=false
log4j.additivity.httpclient.wire.header=false
#
# -------------------------------------------------------------------
# TC_CONS is set to be a ConsoleAppender using a PatternLayout. -----
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d %-5p %c - %m%n
#
# -------------------------------------------------------------------
# TC_CONS is set to be a ConsoleAppender using a PatternLayout. -----
log4j.appender.TC_CONS=org.apache.log4j.ConsoleAppender
log4j.appender.TC_CONS.layout=org.apache.log4j.PatternLayout
log4j.appender.TC_CONS.layout.ConversionPattern=%d %-5p %c - %m%n
# -------------------------------------------------------------------
# TC_ROLF is a rolling file appender --- not used yet / no need to parse
log4j.appender.TC_ROLF=org.apache.log4j.RollingFileAppender
log4j.appender.TC_ROLF.Append=true
log4j.appender.TC_ROLF.File=/E:/tc-60/logs/tomcat_rolf.log
log4j.appender.TC_ROLF.MaxFileSize=2MB
log4j.appender.TC_ROLF.MaxBackupIndex=10
log4j.appender.TC_ROLF.layout=org.apache.log4j.PatternLayout
log4j.appender.TC_ROLF.layout.ConversionPattern=%p %t %c - %m%n
# -------------------------------------------------------------------
# TC_FAP is set to be a File appender using a PatternLayout. -------
log4j.appender.TC_FAP=org.apache.log4j.FileAppender
log4j.appender.TC_FAP.File=/E:/tc-60/logs/tomcat_fap.log
log4j.appender.TC_FAP.Append=true
log4j.appender.TC_FAP.layout=org.apache.log4j.PatternLayout
log4j.appender.TC_FAP.layout.ConversionPattern=%-5p - %m%n
# -------------------------------------------------------------------
# TC_CHAINSAW is an appender sending to a remote host GUI -------
# feeding the TC_CHAINSAW client listening on TCP/IP port 4449
log4j.appender.TC_CHAINSAW=org.apache.log4j.net.SocketHubAppender
#-log4j.appender.TC_CHAINSAW.RemoteHost=C038020
log4j.appender.TC_CHAINSAW.Port=4449
log4j.appender.TC_CHAINSAW.LocationInfo=true
#
#*******************************************************************************
#
log4j.debug=true
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# -------------------------------------------------------------------
#- Set your loggers priority to what you need -----------------------
# Logger logging WHAT it logs WHO is actually logging
log4j.logger.org.apache.axis2=INFO, AX_CONS, AX_ROLF, AX_FAP, AX_CHAINSAW
log4j.logger.org.apache.axis2.deployment=DEBUG, AX_CONS, AX_ROLF, AX_FAP, AX_CHAINSAW
log4j.logger.org.apache.axis2.enterprise=INFO, AX_CONS, AX_ROLF, AX_FAP, AX_CHAINSAW
log4j.logger.org.apache.axiom=WARN, AX_CONS, AX_ROLF, AX_FAP, AX_CHAINSAW
# -------------------------------------------------------------------
log4j.additivity.org.apache.axis2=false
log4j.additivity.org.apache.axis2.deployment=false
log4j.additivity.org.apache.axis2.enterprise=false
log4j.additivity.org.apache.axiom=false
# -------------------------------------------------------------------
#- create the SpServer Logger ---------------------------------------
# this is the CONFIGURED logger for the SpServer.java JavaPart
# the Configurator strips of the logger_prefix "log4j.logger."
# the logger is then known in the hierarchy as
# "axawl.spezpla.servers.SpezplaService.SpServer"
# retrive this configured logger from log4j.hierarchy through
# Logger log = Logger.getLogger(SpServer.class);
log4j.logger.axawl.spezpla.servers.SpezplaService.SpServer=INFO, AX_ROLF, AX_FAP, AX_CHAINSAW
# -------------------------------------------------------------------
# to prevent that logging events are propagated to parent loggers
# and finally arrive at the root loggers appender, printed to the root-
# loggers files i.e. additivity must be set to false to prevent this.
# please goto http://logging.apache.org/log4j/1.2/manual.html and read
# the short manual or buy the full manual
log4j.additivity.axawl.spezpla.servers.SpezplaService.SpServer=false
# -------------------------------------------------------------------
# AX_CONS is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.AX_CONS=org.apache.log4j.ConsoleAppender
log4j.appender.AX_CONS.layout=org.apache.log4j.PatternLayout
log4j.appender.AX_CONS.layout.ConversionPattern=%d %-5p %c - %m%n
# -------------------------------------------------------------------
# AX_ROLF is a rolling file appender --- not used yet / no need to parse
log4j.appender.AX_ROLF=org.apache.log4j.RollingFileAppender
log4j.appender.AX_ROLF.Append=true
log4j.appender.AX_ROLF.File=/E:/axcls/axis2_rolf.log
log4j.appender.AX_ROLF.MaxFileSize=2MB
log4j.appender.AX_ROLF.MaxBackupIndex=10
log4j.appender.AX_ROLF.layout=org.apache.log4j.PatternLayout
log4j.appender.AX_ROLF.layout.ConversionPattern=%p %t %c - %m%n
# -------------------------------------------------------------------
# AX_FAP is set to be a File appender using a PatternLayout. -------
log4j.appender.AX_FAP=org.apache.log4j.FileAppender
log4j.appender.AX_FAP.File=/E:/axcls/axis2_fap.log
log4j.appender.AX_FAP.Append=true
log4j.appender.AX_FAP.layout=org.apache.log4j.PatternLayout
log4j.appender.AX_FAP.layout.ConversionPattern=%-5p - %m%n
# -------------------------------------------------------------------
# AX_CHAINSAW is an appender sending to a remote host GUI -------
# feeding the AX_CHAINSAW client listening on TCP/IP port 4450
log4j.appender.AX_CHAINSAW=org.apache.log4j.net.SocketHubAppender
log4j.appender.AX_CHAINSAW.Port=4450
log4j.appender.AX_CHAINSAW.LocationInfo=true
-----Ursprüngliche Nachricht-----
Von: Sumitha Arjunan [mailto:Sumitha.Arjunan@lntinfotech.com]
Gesendet: Donnerstag, 8. Dezember 2011 06:43
An: log4j-user@logging.apache.org
Betreff: reg individual log files for each request
Hi,
In our application, we have to write the logs into different log files based on the reference number in the file.
For example suppose my file FileSample.txt is having reference 1123 , then the log file name should be ref1123.txt and whenever it come across the same reference, it has to write into the same file.
If the subsequent request deals with some other reference(4456) number it has to write the logs into the ref4456.txt.
Please let me know how can I implement this functionality.
Sumiarjun
________________________________
The contents of this e-mail and any attachment(s) may contain confidential or privileged information for the intended recipient(s). Unintended recipients are prohibited from taking action on the basis of information in this e-mail and using or disseminating the information, and must notify the sender and delete it from their system. L&T Infotech will not accept responsibility or liability for the accuracy or completeness of, or the presence of any virus or disabling code in this e-mail"
*************************************************************************
This email and attachments have been scanned for
potential proprietary or sensitive information leakage.
Websense Data Security, Protecting Your Information from the Inside Out.
www.websense.com
*************************************************************************
______________________________________________________________________