Can you use jstack to get a list of the threads when your app hangs? I don't see why your idea of combining async loggers with an async appender with blocking=false would not work.
Sent from my iPhone > On 2015/03/19, at 16:50, Giovanni De Martino <[email protected]> > wrote: > > Hi guys and thank you very much for the precious help. > What I'm trying to obtain is a logging configuration that prevent my > intensive traffic web application to hang for any kind of problem on the > log database I use (mongoDB). > currently the storage on which mongoDb is running is not so reliable, so > our insert of log entries may take seconds (we write several hundreds of > log entries per second). > I'd like to loose log entries but do not stop the service to my customer, > that is the web application. > > Below is how my log4j.xml looks like. > I use log4j 2.1 and all my Loggers are asyncronous with a ringbuffer of > around 130.000 Entries. > Then, the asyncronous Logger refers to an asyncronous NoSQL Appender for > MongoDB, with a default buffer of 128 entries and the blocking parameter > set to "false". > When troubles on MongoDB storage happen and last for some hours, I was > expecting the buffer become full for high write operation delay and then we > start discard logging (blocking="false") without blocking the application. > Instead what I'm seeing is that after some hour my application hangs and > does not respond anymore. > Please, can you suggest me a better configuration in order to avoid this > kind of issue. > Of course I'm trying to solve the storage issues, but I need in any case to > cut dependencies of my core web functionalities from log writing. > > Again, many many thanks in advance for your precious help. > Regards, Giovanni > > <?xml version="1.0" encoding="UTF-8"?> > <Configuration status="INFO" packages="it.xxx.yyy.logger.appender"> > <Appenders> > <NoSqlCustom name="operationAppender"> > <MongoDb collectionName="log" > factoryClassName="it.xxx.yyy.logger.db.DBConnection" > factoryMethodName="operationConnection" > writeConcernConstant="UNACKNOWLEDGED" /> > </NoSqlCustom> > <NoSqlCustom name="transactionAppender"> > <MongoDb collectionName="log" > factoryClassName="it.xxx.yyy.logger.db.DBConnection" > factoryMethodName="transactionConnection" > writeConcernConstant="UNACKNOWLEDGED" /> > </NoSqlCustom> > <Console name="CONSOLE" target="SYSTEM_OUT"> > <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - > %msg%n" /> > </Console> > <Async name="dam-transaction-async" blocking="false"> > <AppenderRef ref="transactionAppender" /> > </Async> > <Async name="dam-operation-async" blocking="false"> > <AppenderRef ref="operationAppender" /> > </Async> > </Appenders> > <Loggers> > <Logger name="opLogger" level="DEBUG" additivity="false"> > <AppenderRef ref="dam-operation-async"/> > </Logger> > <Logger name="tranLogger" level="INFO" additivity="false"> > <AppenderRef ref="dam-transaction-async"/> > </Logger> > <Root level="DEBUG"> > <AppenderRef ref="CONSOLE"/> > </Root> > </Loggers> > </Configuration> > > > >> On Thu, Mar 19, 2015 at 5:25 AM, Remko Popma <[email protected]> wrote: >> >> Async Appender uses a different mechanism than Async Loggers (and a >> different queue, separate from the AsyncLogger ringbuffer). >> >> With AsyncAppender it is possible to control the blocking behaviour with a >> config parameter. In contrast, Async Loggers always block if the ringbuffer >> is full. >> >> Best regards, >> >> Remko >> >> Sent from my iPhone >> >>>> On 2015/03/19, at 9:53, Giovanni De Martino < >>> [email protected]> wrote: >>> >>> Many thanks Remko. >>> Just another question: >>> If the logger is connected to an Async Appender with the blocking >> parameter set to "false", how is possible that the ringbuffer become full? >>> >>> >>> ----- Messaggio originale ----- >>> Da: "Remko Popma" <[email protected]> >>> Inviato: 19/03/2015 01:01 >>> A: "Log4J Users List" <[email protected]> >>> Oggetto: Re: Log4j 2.x AsyncLogger >>> >>> When the ringbuffer is full, calls to the logger become blocking calls. >> There is no mechanism to discard log events. >>> >>> Best regards, >>> Remko >>> >>> Sent from my iPhone >>> >>>> On 2015/03/19, at 6:40, Giovanni De Martino < >> [email protected]> wrote: >>>> >>>> Hi all, >>>> I'm currently using Log4j 2.1 in a production environment. >>>> I'm using all Async Logger with a RingBuffer of around 130.000 entries >> and >>>> then an AsyncAppender towards MongoDB. >>>> I'd like to kindle ask you following question: >>>> what happen is the RingBuffer of the AsynLogger (not the Async Appender) >>>> become full? >>>> It is a blocking buffer or old log entries not even passed to the >> appender >>>> are discarded and new ones overwrite then into the ring? >>>> >>>> Many thansk, giovanni >>>> >>>> >>>> -- >>>> Giovanni De Martino >>>> [email protected] >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] > > > -- > Giovanni De Martino (AKA Harry Potter) > [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
