logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stadelmann Josef" <josef.stadelm...@axa-winterthur.ch>
Subject AW: FileAppender problem
Date Mon, 14 Feb 2011 17:53:19 GMT
In case you have conflicts, it is a good Idea to consolidate all different log4j.properties
into one big log4j.properties and have that used when TOMCAT starts. This just fior a test.
If then all runs, then your problems may be that of a access conflict; i.e. trying to open
a file or a channel which is already open.

It helped for me in many case.
Josef



-----Urspr√ľngliche Nachricht-----
Von: Umesh Awasthi [mailto:umeshawasthi@gmail.com] 
Gesendet: Montag, 14. Februar 2011 15:35
An: log4j-user
Betreff: Re: FileAppender problem

Hi All,

Can any one help me in this,it seems the my tomcat server keeping a refrence
of all fileappender

On Sat, Feb 12, 2011 at 11:22 AM, Umesh Awasthi <umeshawasthi@gmail.com>wrote:

> Hi All,
>
> I am working on a webapplication and i have a requirment to generate log
> files at run time for my impex process.here is the use case
> i am validating an XML file and validation error is being handled by custom
> Error handler.This error hanlde will be passed to the underlying validator
> (Jaxb 2.x validator),so i have to create the log file when the instance of
> this error hanlder is being created.
>
> here is the code to create log file at run time
> FileAppender appender;
>             try {
>                 appender = new FileAppender(layout, sb.toString(), false);
>                 log.addAppender(appender);
>                 log.setAdditivity(false);
>                 log.setLevel(Level.WARN);
>             } catch (IOException e) {
>                 e.printStackTrace();
>             }
>
> everything is working fine and file is being created correctly as well
> being written by the logger to the respective place.
> but if i restart my server real problem starts and logger starting
> appending the log content not only to its pareent class as well other
> classes.here is the details
> lets suppose i have 3 log (A,B,C) files already at the location with 3
> lines in each log file and C was the latest file created in the process.
>  so when i restart my server it some how appending data in to previos all
> log files in this fashin
> C has still 3 lines
> B has now 6 lines
> A has now 9 lines
>
> it seems that the appender i hace created is still open or have refrence
> not sure what exactly going on.
> any help in this regard will be helpfull.
>
>
> --
> With Regards
> Umesh Awasthi
> http://www.travellingrants.com/
>
>
>



-- 
With Regards
Umesh Awasthi
http://www.travellingrants.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message