Re: Recursive call to appender stackoverflow error
I only have log4j-slf4j-impl org.apache.logging.log4j log4j-api ${log4j.version} org.apache.logging.log4j log4j-core ${log4j.version} org.apache.logging.log4j log4j-slf4j-impl ${log4j.version} On Fri, Dec 11, 2015 at 1:52 PM, Remko Popma <remko.po...@gmail.com> wrote: > Did this resolve the problem? > > On Friday, 11 December 2015, Remko Popma <remko.po...@gmail.com> wrote: > > > You may have both the log4j-to-slf4j adapter jar and the log4j-slf4j-impl > > jar on the classpath. They will route calls to each other. You need to > > remove one of them. > > > > Sent from my iPhone > > > > > On 2015/12/11, at 10:55, Priya Ahuja <priahuja...@gmail.com > > <javascript:;>> wrote: > > > > > > Hi, > > > > > > Any idea why I am seeing stackoverflow error? I am using log4j2 and > > LOGFILE > > > is my rolling file appender. > > > > > > Exception in thread > > > > > > "pool-28-thread-2-workitem-HOST-cf95a544-c4b1-4084-861b-80e4ed4f4045-workitem-HOST-56de5b12-2d80-49c8-8b21-90433c89a2a1" > > > java.lang.StackOverflowError > > > Exception in thread > > > "pool-37-thread-1-workitem-HOST-ba35b9e4-1c83-4a42-af8a-6902f2eed941" > > > java.lang.StackOverflowError > > > 2015-12-10 17:22:11,041 ERROR Recursive call to appender LOGFILE > > > 2015-12-10 17:22:11,042 ERROR Recursive call to appender LOGFILE > > > 2015-12-10 17:22:11,042 ERROR Recursive call to appender LOGFILE > > > 2015-12-10 17:22:11,042 ERROR Recursive call to appender LOGFILE > > > Exception in thread > > > > > > "pool-37-thread-2-workitem-HOST-5162cb6e-16bc-4754-a44b-1947e441a3b5-workitem-HOST-ff45f0c7-e25e-48f8-ba7c-199912c015ac" > > > java.lang.StackOverflowError > > > at > > > > > > org.apache.logging.log4j.spi.AbstractLogger.isTraceEnabled(AbstractLogger.java:591) > > > > > > > > > Thanks, > > > Priya Ahuja > > >
Recursive call to appender stackoverflow error
Hi, Any idea why I am seeing stackoverflow error? I am using log4j2 and LOGFILE is my rolling file appender. Exception in thread "pool-28-thread-2-workitem-HOST-cf95a544-c4b1-4084-861b-80e4ed4f4045-workitem-HOST-56de5b12-2d80-49c8-8b21-90433c89a2a1" java.lang.StackOverflowError Exception in thread "pool-37-thread-1-workitem-HOST-ba35b9e4-1c83-4a42-af8a-6902f2eed941" java.lang.StackOverflowError 2015-12-10 17:22:11,041 ERROR Recursive call to appender LOGFILE 2015-12-10 17:22:11,042 ERROR Recursive call to appender LOGFILE 2015-12-10 17:22:11,042 ERROR Recursive call to appender LOGFILE 2015-12-10 17:22:11,042 ERROR Recursive call to appender LOGFILE Exception in thread "pool-37-thread-2-workitem-HOST-5162cb6e-16bc-4754-a44b-1947e441a3b5-workitem-HOST-ff45f0c7-e25e-48f8-ba7c-199912c015ac" java.lang.StackOverflowError at org.apache.logging.log4j.spi.AbstractLogger.isTraceEnabled(AbstractLogger.java:591) Thanks, Priya Ahuja
Suppressing exception trace to exception message only
Hi, I am using log4jv2.3, I am looking for a way to suppress the exception trace and limit it to exception message only using log4j configuration? Thanks, Priya Ahuja
Re: how to detect logger is unable to write to file?
I am seeing a similar issue with log4j2, is there any log that contains the error that log4j was not able to write to file? On Thu, Oct 29, 2015 at 3:53 PM, Remko Popmawrote: > What action should the daemon take when its quota is reached? > > Sent from my iPhone > >> On 2015/10/30, at 2:21, degenaro wrote: >> >> We use log4j with rolling appenders for daemons that run 24x7. The daemons >> run as a user on linux and the log files are written to a filesystem that >> has a quota. Normally this works great. Once in a while (usually due to >> human error) the quota is exceeded. This, unfortunately, prevents the >> daemons from writing their logs...worst of all silently. There is no >> indication that anything is wrong! >> >> So my question is: how do we configure log4j so that when logging (to file) >> fails the daemon can find out and take appropriate action? >> >> >> >> -- >> View this message in context: >> http://apache-logging.6191.n7.nabble.com/how-to-detect-logger-is-unable-to-write-to-file-tp59123.html >> Sent from the Log4j - Users mailing list archive at Nabble.com. >> >> - >> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org >> For additional commands, e-mail: log4j-user-h...@logging.apache.org >> > > - > To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org > For additional commands, e-mail: log4j-user-h...@logging.apache.org > - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: how to detect logger is unable to write to file?
The closest I could find was to use -Dlog4j.debug, this will put (configuration) errors with appenders on the console. On Thu, Oct 29, 2015 at 5:17 PM, Ralph Goers <ralph.go...@dslextreme.com> wrote: > Did you specify ignoreException=false? > > Ralph > >> On Oct 29, 2015, at 4:06 PM, Priya Ahuja <priahuja...@gmail.com> wrote: >> >> I am seeing a similar issue with log4j2, is there any log that >> contains the error that log4j was not able to write to file? >> >> On Thu, Oct 29, 2015 at 3:53 PM, Remko Popma <remko.po...@gmail.com> wrote: >>> What action should the daemon take when its quota is reached? >>> >>> Sent from my iPhone >>> >>>> On 2015/10/30, at 2:21, degenaro <lou.degen...@gmail.com> wrote: >>>> >>>> We use log4j with rolling appenders for daemons that run 24x7. The daemons >>>> run as a user on linux and the log files are written to a filesystem that >>>> has a quota. Normally this works great. Once in a while (usually due to >>>> human error) the quota is exceeded. This, unfortunately, prevents the >>>> daemons from writing their logs...worst of all silently. There is no >>>> indication that anything is wrong! >>>> >>>> So my question is: how do we configure log4j so that when logging (to file) >>>> fails the daemon can find out and take appropriate action? >>>> >>>> >>>> >>>> -- >>>> View this message in context: >>>> http://apache-logging.6191.n7.nabble.com/how-to-detect-logger-is-unable-to-write-to-file-tp59123.html >>>> Sent from the Log4j - Users mailing list archive at Nabble.com. >>>> >>>> - >>>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org >>>> For additional commands, e-mail: log4j-user-h...@logging.apache.org >>>> >>> >>> - >>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org >>> For additional commands, e-mail: log4j-user-h...@logging.apache.org >>> >> >> - >> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org >> For additional commands, e-mail: log4j-user-h...@logging.apache.org >> >> > > > > - > To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org > For additional commands, e-mail: log4j-user-h...@logging.apache.org > - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: Structured data appearing twice
Thanks Gary! I will update after trying with 2.3. I have a mild idea on what may be going wrong. My requirement is that I need userdefined id (messageid) and configuration based structured data. 1. Messageid is only parsed in log4j if the message is an instance of StructuredDataMessage, hence I am forced to send my message to log4j as structuredDataMessage with empty Map for structured data 2. As a result, the final message gets parsed indexed with two maps, once from the config file and other from the message itself Thanks, Priya Ahuja On Mon, Sep 14, 2015 at 7:57 PM, Gary Gregory <garydgreg...@gmail.com> wrote: > Can you try version 2.3 or 2.4 out of Git master? > > Gary > > On Tue, Aug 4, 2015 at 1:41 PM, Priya Ahuja <priahuja...@gmail.com> wrote: > > > Hi Gary, > > > > I am currently using version 2.1. > > > > I have attached the log4j configuration file. > > > > Thanks, > > Priya Ahuja > > > > > > > > On Tue, Aug 4, 2015 at 12:36 PM, Gary Gregory <garydgreg...@gmail.com> > > wrote: > > > >> Hi Priya, > >> > >> What is your configuration? What version are you using? > >> > >> Gary > >> > >> On Tue, Aug 4, 2015 at 12:30 PM, Priya Ahuja <priahuja...@gmail.com> > >> wrote: > >> > >> > Hi, > >> > > >> > I am trying to add structured data using includeMDC and loggerfields > >> but I > >> > also want MESSAGE-ID passed by the user in the log. > >> > > >> > *My current implementation:* > >> > I am passing StructuredDataMessage to logIfEnabled since that is the > >> only > >> > way to pass user defined message-id > >> >- StructuredDataMessage((String)null, msg, messageId) > >> > > >> > But I want the structured data picked up from* XML configuration:* > >> > > >> > >> >* id="LS" includeMDC="true" mdcId="enterprise"* > >> > mdcIncludes="comp,subcomp"> > >> > > >> > > >> > > >> > > >> > > >> > As a result my structured data appears twice in the log: > >> > <182>1 2015-08-03T20:28:16.413Z localhost - - USER *[enterprise@6876 > >> > level="dummy" id="dummy"][@6876] *This is a dummy log > >> > > >> > Any help appreciated. > >> > > >> > Thanks, > >> > Priya Ahuja > >> > > >> > >> > >> > >> -- > >> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org > >> Java Persistence with Hibernate, Second Edition > >> <http://www.manning.com/bauer3/> > >> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> > >> Spring Batch in Action <http://www.manning.com/templier/> > >> Blog: http://garygregory.wordpress.com > >> Home: http://garygregory.com/ > >> Tweet! http://twitter.com/GaryGregory > >> > > > > > > > > - > > To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org > > For additional commands, e-mail: log4j-user-h...@logging.apache.org > > > > > > -- > E-Mail: garydgreg...@gmail.com | ggreg...@apache.org > Java Persistence with Hibernate, Second Edition > <http://www.manning.com/bauer3/> > JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> > Spring Batch in Action <http://www.manning.com/templier/> > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory >
Re: Structured data appearing twice
my syslog configuration is: On Tue, Sep 15, 2015 at 2:12 PM, Priya Ahuja <priahuja...@gmail.com> wrote: > I have a common logging library integrated with log4j which is being used > by different packages/classes. I want a custom messageid in the log entry > so that filtering is easy. At the same time I want structured data fields > to be a part of configuration. For ex: > > *<180>1 2015-02-12T00:04:57:627Z 10.1.1.2 - - HTTP [ id@68146 > comp="manager” subcomp=“web" ] Received an HTTP request.* > > * <180>1 2015-02-12T00:04:57:627Z 10.1.1.2 - - RPC [ id@68146 > comp="manager” subcomp=“web"] Received an RPC request.* > > The messageid will be passed as part of logger constructor based on the > log message content (logger constructor modified to do so) but the > structured data fields are common that can be provided in the configuration > using MDC but it doesn't work since I need messageid to be custom I am > forced to use StructuredDataMessage (see below). Currently I am passing the > structured data fields and the messageid as part of the message itself, see > code below: > > private Message format(final String pattern, final Object... arguments) { > String msg = arguments != null ? > Utils.formatAsLogSFPattern(pattern, arguments) : pattern; > Map<String, String> m = new HashMap<String, String>(); > m.put("comp", *this.comp*); *//messageid, comp and subcomp > is received as part of logger constructor* > m.put("subcomp",* this.subcomp*); > return new *StructuredDataMessage*("nsx", msg,* this.messageId, m* > ); > } > > public void fatal(String format, Object... args) { > if (log4jLogger.isEnabled(Level.FATAL)) { > log4jLogger.logIfEnabled(FQCN, Level.FATAL, null, > format(format, args), null); > } > } > > If I remove the map implementation and pass NULL then I get 2 structured > data fields in the log. > > > On Tue, Sep 15, 2015 at 1:00 PM, Ralph Goers <ralph.go...@dslextreme.com> > wrote: > >> Can you describe your use case in a bit more detail? Maybe we can >> provide some other ideas on how to resolve it. >> >> Ralph >> >> > On Sep 15, 2015, at 12:17 PM, Priya Ahuja <priahuja...@gmail.com> >> wrote: >> > >> > Thanks Gary! I will update after trying with 2.3. I have a mild idea on >> > what may be going wrong. My requirement is that I need userdefined id >> > (messageid) and configuration based structured data. >> > >> > 1. Messageid is only parsed in log4j if the message is an instance of >> > StructuredDataMessage, hence I am forced to send my message to log4j as >> > structuredDataMessage with empty Map for structured data >> > 2. As a result, the final message gets parsed indexed with two maps, >> once >> > from the config file and other from the message itself >> > >> > Thanks, >> > Priya Ahuja >> > >> > On Mon, Sep 14, 2015 at 7:57 PM, Gary Gregory <garydgreg...@gmail.com> >> > wrote: >> > >> >> Can you try version 2.3 or 2.4 out of Git master? >> >> >> >> Gary >> >> >> >> On Tue, Aug 4, 2015 at 1:41 PM, Priya Ahuja <priahuja...@gmail.com> >> wrote: >> >> >> >>> Hi Gary, >> >>> >> >>> I am currently using version 2.1. >> >>> >> >>> I have attached the log4j configuration file. >> >>> >> >>> Thanks, >> >>> Priya Ahuja >> >>> >> >>> >> >>> >> >>> On Tue, Aug 4, 2015 at 12:36 PM, Gary Gregory <garydgreg...@gmail.com >> > >> >>> wrote: >> >>> >> >>>> Hi Priya, >> >>>> >> >>>> What is your configuration? What version are you using? >> >>>> >> >>>> Gary >> >>>> >> >>>> On Tue, Aug 4, 2015 at 12:30 PM, Priya Ahuja <priahuja...@gmail.com> >> >>>> wrote: >> >>>> >> >>>>> Hi, >> >>>>> >> >>>>> I am trying to add structured data using includeMDC and loggerfields >> >>>> but I >> >>>>> also want MESSAGE-ID passed by the user in the log. >> >>>>> >> >>>>> *My current implementation:* >> >>>>>
Re: Structured data appearing twice
I have a common logging library integrated with log4j which is being used by different packages/classes. I want a custom messageid in the log entry so that filtering is easy. At the same time I want structured data fields to be a part of configuration. For ex: *<180>1 2015-02-12T00:04:57:627Z 10.1.1.2 - - HTTP [ id@68146 comp="manager” subcomp=“web" ] Received an HTTP request.* * <180>1 2015-02-12T00:04:57:627Z 10.1.1.2 - - RPC [ id@68146 comp="manager” subcomp=“web"] Received an RPC request.* The messageid will be passed as part of logger constructor based on the log message content (logger constructor modified to do so) but the structured data fields are common that can be provided in the configuration using MDC but it doesn't work since I need messageid to be custom I am forced to use StructuredDataMessage (see below). Currently I am passing the structured data fields and the messageid as part of the message itself, see code below: private Message format(final String pattern, final Object... arguments) { String msg = arguments != null ? Utils.formatAsLogSFPattern(pattern, arguments) : pattern; Map<String, String> m = new HashMap<String, String>(); m.put("comp", *this.comp*); *//messageid, comp and subcomp is received as part of logger constructor* m.put("subcomp",* this.subcomp*); return new *StructuredDataMessage*("nsx", msg,* this.messageId, m*); } public void fatal(String format, Object... args) { if (log4jLogger.isEnabled(Level.FATAL)) { log4jLogger.logIfEnabled(FQCN, Level.FATAL, null, format(format, args), null); } } If I remove the map implementation and pass NULL then I get 2 structured data fields in the log. On Tue, Sep 15, 2015 at 1:00 PM, Ralph Goers <ralph.go...@dslextreme.com> wrote: > Can you describe your use case in a bit more detail? Maybe we can provide > some other ideas on how to resolve it. > > Ralph > > > On Sep 15, 2015, at 12:17 PM, Priya Ahuja <priahuja...@gmail.com> wrote: > > > > Thanks Gary! I will update after trying with 2.3. I have a mild idea on > > what may be going wrong. My requirement is that I need userdefined id > > (messageid) and configuration based structured data. > > > > 1. Messageid is only parsed in log4j if the message is an instance of > > StructuredDataMessage, hence I am forced to send my message to log4j as > > structuredDataMessage with empty Map for structured data > > 2. As a result, the final message gets parsed indexed with two maps, once > > from the config file and other from the message itself > > > > Thanks, > > Priya Ahuja > > > > On Mon, Sep 14, 2015 at 7:57 PM, Gary Gregory <garydgreg...@gmail.com> > > wrote: > > > >> Can you try version 2.3 or 2.4 out of Git master? > >> > >> Gary > >> > >> On Tue, Aug 4, 2015 at 1:41 PM, Priya Ahuja <priahuja...@gmail.com> > wrote: > >> > >>> Hi Gary, > >>> > >>> I am currently using version 2.1. > >>> > >>> I have attached the log4j configuration file. > >>> > >>> Thanks, > >>> Priya Ahuja > >>> > >>> > >>> > >>> On Tue, Aug 4, 2015 at 12:36 PM, Gary Gregory <garydgreg...@gmail.com> > >>> wrote: > >>> > >>>> Hi Priya, > >>>> > >>>> What is your configuration? What version are you using? > >>>> > >>>> Gary > >>>> > >>>> On Tue, Aug 4, 2015 at 12:30 PM, Priya Ahuja <priahuja...@gmail.com> > >>>> wrote: > >>>> > >>>>> Hi, > >>>>> > >>>>> I am trying to add structured data using includeMDC and loggerfields > >>>> but I > >>>>> also want MESSAGE-ID passed by the user in the log. > >>>>> > >>>>> *My current implementation:* > >>>>> I am passing StructuredDataMessage to logIfEnabled since that is the > >>>> only > >>>>> way to pass user defined message-id > >>>>> - StructuredDataMessage((String)null, msg, messageId) > >>>>> > >>>>> But I want the structured data picked up from* XML configuration:* > >>>>> > >>>>> >>>>> * id="LS" includeMDC="true" mdcId="enterprise"* > >>>>>mdcIncludes="comp,subcomp"> > >>>>> > >>
Custom Markers
Hi, I am currently using log4j2.0 and I have implemented Marker (SYSLOG_MARKER) for deciding the destination of a log to be localfile log or syslog. But with this approach all the existing logs in the system (~5000) will need manual decision and addition of marker to every single log. Is there a better way to filter logs at INFO level? I don't want to introduce a new level. Thanks, Priya Ahuja
Structured data appearing twice
Hi, I am trying to add structured data using includeMDC and loggerfields but I also want MESSAGE-ID passed by the user in the log. *My current implementation:* I am passing StructuredDataMessage to logIfEnabled since that is the only way to pass user defined message-id - StructuredDataMessage((String)null, msg, messageId) But I want the structured data picked up from* XML configuration:* Syslog name=RFC5424 format=RFC5424 enterpriseNumber=6876 * id=LS includeMDC=true mdcId=enterprise* mdcIncludes=comp,subcomp LoggerFields KeyValuePair key=level value=dummy / KeyValuePair key=id value=dummy / /LoggerFields As a result my structured data appears twice in the log: 1821 2015-08-03T20:28:16.413Z localhost - - USER *[enterprise@6876 level=dummy id=dummy][@6876] *This is a dummy log Any help appreciated. Thanks, Priya Ahuja
Re: Structured data appearing twice
Hi Gary, I am currently using version 2.1. I have attached the log4j configuration file. Thanks, Priya Ahuja On Tue, Aug 4, 2015 at 12:36 PM, Gary Gregory garydgreg...@gmail.com wrote: Hi Priya, What is your configuration? What version are you using? Gary On Tue, Aug 4, 2015 at 12:30 PM, Priya Ahuja priahuja...@gmail.com wrote: Hi, I am trying to add structured data using includeMDC and loggerfields but I also want MESSAGE-ID passed by the user in the log. *My current implementation:* I am passing StructuredDataMessage to logIfEnabled since that is the only way to pass user defined message-id - StructuredDataMessage((String)null, msg, messageId) But I want the structured data picked up from* XML configuration:* Syslog name=RFC5424 format=RFC5424 enterpriseNumber=6876 * id=LS includeMDC=true mdcId=enterprise* mdcIncludes=comp,subcomp LoggerFields KeyValuePair key=level value=dummy / KeyValuePair key=id value=dummy / /LoggerFields As a result my structured data appears twice in the log: 1821 2015-08-03T20:28:16.413Z localhost - - USER *[enterprise@6876 level=dummy id=dummy][@6876] *This is a dummy log Any help appreciated. Thanks, Priya Ahuja -- E-Mail: garydgreg...@gmail.com | ggreg...@apache.org Java Persistence with Hibernate, Second Edition http://www.manning.com/bauer3/ JUnit in Action, Second Edition http://www.manning.com/tahchiev/ Spring Batch in Action http://www.manning.com/templier/ Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory ?xml version=1.0 encoding=UTF-8? Configuration monitorInterval=30 status=FATAL shutdownHook=disable Appenders Syslog name=RFC5424 format=RFC5424 host=${bundle:syslog.server.host} port=${bundle:syslog.server.port} protocol=${bundle:syslog.server.protocol} appName=${bundle:syslog.app_name} facility=${bundle:syslog.facility.log4j} enterpriseNumber=${bundle:syslog.enterprise_number} newLine=true id=LS includeMDC=true mdcId=enterprise mdcIncludes=level,id LoggerFields KeyValuePair key=level value=dummy / KeyValuePair key=id value=dummy / /LoggerFields ThresholdFilter level=INFO/ /Syslog /Appenders Loggers Root level=INFO AppenderRef ref=RFC5424”/ !-- Do not remove Syslog appender -- /Root /Loggers /Configuration - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org