[ 
https://issues.apache.org/jira/browse/LOG4J2-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13917799#comment-13917799
 ] 

Remko Popma edited comment on LOG4J2-510 at 10/22/14 2:51 PM:
--------------------------------------------------------------

Yes I' using RoutingAppender, here is my config:
{code}
                                <Route>
                                        <RollingFile 
name="Rolling-${ctx:sessionID}"
                                                
fileName="./logs/${ctx:sessionID}.log"
                                                filePattern="">
                                                <PatternLayout>
                                                        <pattern>%d: %6p : [%t] 
: [%c{1}] : %m%n</pattern>
                                                </PatternLayout>
                                                <SizeBasedTriggeringPolicy />
                                        </RollingFile>
                                </Route>
{code}
what I m doing is that I m creating logs base on ThreadContext. My app create a 
Thread for each client (session)
log4j2 then create files base on each client session id. so if I have 1000 
clients at the time I will have 1000 files or more generated for each session.
Those files are now open and I m logging into it base on the Thread. The 
problem comes when the session expired and the file become inactive and stays 
open
the more session I create the more files are generated up to a stage where the 
OS complaint that too many files are open and the App crash.


was (Author: erick):
Yes I' using RoutingAppender, here is my config:
                                <Route>
                                        <RollingFile 
name="Rolling-${ctx:sessionID}"
                                                
fileName="./logs/${ctx:sessionID}.log"
                                                filePattern="">
                                                <PatternLayout>
                                                        <pattern>%d: %6p : [%t] 
: [%c{1}] : %m%n</pattern>
                                                </PatternLayout>
                                                <SizeBasedTriggeringPolicy />
                                        </RollingFile>
                                </Route>
what I m doing is that I m creating logs base on ThreadContext. My app create a 
Thread for each client (session)
log4j2 then create files base on each client session id. so if I have 1000 
clients at the time I will have 1000 files or more generated for each session.
Those files are now open and I m logging into it base on the Thread. The 
problem comes when the session expired and the file become inactive and stays 
open
the more session I create the more files are generated up to a stage where the 
OS complaint that too many files are open and the App crash.

> How to close inactive log files
> -------------------------------
>
>                 Key: LOG4J2-510
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-510
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.0-beta9
>         Environment: linux
>            Reporter: Eric
>            Assignee: Ralph Goers
>              Labels: performance
>
> Hi There,
> in log4j2 when the App start logging it create and open a file to log into 
> and that file stay open as long as the App is running.
> in my case log4j2 create and open too many files base on ThreadContext and 
> the OS (linux) will complaint that too many files are open and my App will 
> crash and stop responding.
> My question is:
>  1 -  how do you close those files with log4j2 if they are inactive for a 
> period of time.
>  2 - How do you have access to the log4j2 handle that open those files.
>  3 - How do you tell log4j2 to open a file just for a period of time.
> Thanks
> Eric



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to