Jose Luis Valencia | 7 Jul 17:18 2015
Picon

Exception using log4j-web and spring WebApplicationInitializer

I want to use log4j-web in a app that uses spring WebApplicationInitializer
but when I include log4j-web dependency the application gives this
exception:

java.lang.IllegalStateException: Cannot initialize context because there is
already a root application context present - check whether you have
multiple ContextLoader* definitions in your web.xml!
at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:277)
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at
org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:800)

 and my WebApplicationInitializer is called twice even when I set
"isLog4jAutoInitializationDisabled"
context param to "true" programmatically and in web.xml.

​José Valencia​
Sandeep Dasika | 7 Jul 09:01 2015
Picon

Query regarding SocketAppender and SimpleSocketServer

Hi log4j team,

I have been using log4j in production systems, and it has delivered us
fantastically. My query is around the SocketAppender and SimpleSocketServer
functionality. We have a group of servers that generate log events. These
are configured to write to file appenders. We also want to have error logs
written to a central log file so that it can be easy to browse to find
potential issues in our product.

I have the natural setup for the remote logging up and running perfectly -
The clients that generate the LoggingEvent objects (our production servers)
all write to a SocketAppender that will send it across to the remote
SimpleSocketServer and that ultimately writes to another file appender,
which gives us the centralised log file to browse. However, since we want
to run it at ERROR level, it would be best for us if we have some client ID
(maybe IP) of the client that sends a particular logging event at the
remote end so that it would be easier for us to pinpoint the problems in
our systems. Seems like I'm not sure how that can be done in log4j. Any
hints/suggestions on this would really help me out!

Thanks in advance.
Cheers!
Gary Gregory | 6 Jul 17:21 2015
Picon

Re: Parameter isLog4jAutoInitializationDisabled ignored when used alongside log4jConfiguration?

Did you get you configuration to work?

Gary

On Fri, Jun 26, 2015 at 1:57 AM, Gary Gregory <garydgregory <at> gmail.com>
wrote:

> OK, so we can rule out the obvious Tomcat 7.0.43 issue mentioned on
> https://logging.apache.org/log4j/2.x/manual/webapp.html
>
> Gary
>
> On Fri, Jun 26, 2015 at 1:17 AM, Robin Jansohn <snoopi30 <at> web.de> wrote:
>
>> Starting Servlet Engine: Apache Tomcat/7.0.47
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-logging.6191.n7.nabble.com/Parameter-isLog4jAutoInitializationDisabled-ignored-when-used-alongside-log4jConfiguration-tp54034p55867.html
>> Sent from the Log4j - Users mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe <at> logging.apache.org
>> For additional commands, e-mail: log4j-user-help <at> logging.apache.org
>>
>>
>
>
(Continue reading)

David KOCH | 6 Jul 13:14 2015

Get properties from configuration programatically.

Hello,

Is there a way to get the properties from a log4j2 configuration file
programatically?

Like:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG" monitorInterval="10">

  <Properties>
    <Property name="kafkaHost">localhost:9092</Property>
  </Properties>

  ...
</Configuration>

I tried:

LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
ctx.getConfiguration().getProperties();

However, this only returns global properties like hostName and not the
custom ones I added to the configuration.

Thank you,

/David
Simon | 3 Jul 19:22 2015
Picon

Re: RollingFileAppeneder MaxSize + keep 30 days

If you're stuck on Log4J 1.2 then you could try out the TimeAndSizeRollingAppender available at www.simonsite.org.uk.

Sent from TypeMail

On 2 Jul 2015 23:54, at 23:54, Benjamin Jaton <benjamin.jaton <at> gmail.com> wrote:
>Hello,
>
>How can I define a RollingFileAppender that would roll when it reaches
>100MB, and that would discard any log older than 30 days (not before)?
>
>I need to keep 30 days of logs for auditing purposes, but I also want
>to
>limit the logs to a certain size as well.
>
>Thanks!
>Ben
Jose Luis Valencia | 3 Jul 16:38 2015
Picon

Log4j - Jul Bridge in a web application

​I am working with Java components that use JUL in a web application and I
am not able to get JUL logs routed to log4j 2, I added the required maven
dependency for log4j-jul and set
-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager ​in the
command line but maven gives an NoSuchClassexception because
org.apache.logging.log4j.jul.LogManager is not yet loaded and by
System.setProperty() in a spring CustomWebApplicationInitializer but
https://logging.apache.org/log4j/log4j-2.2/log4j-jul/index.html says it
must be called before any call of to LogManager or Logger. ¿Where I should
set the system property in a web application?

Thank you!

*JOSÉ L. VALENCIA G.*​
Benjamin Jaton | 3 Jul 00:53 2015
Picon

RollingFileAppeneder MaxSize + keep 30 days

Hello,

How can I define a RollingFileAppender that would roll when it reaches
100MB, and that would discard any log older than 30 days (not before)?

I need to keep 30 days of logs for auditing purposes, but I also want to
limit the logs to a certain size as well.

Thanks!
Ben
dyf6372 | 1 Jul 10:43 2015

Question about using log4j

We use log4j to print the log about our system. Sometimes the computer will be crashed and reboot. Before the
computer down, the log4j will print many " <at> ". I want to know what the meaning of “ <at> “ is and when it will
appear. Thank you very much!

My Best Wishes!
董一峰
15201346372
dyf6372 <at> 163.com dyf6372 <at> gmail.com
Saurabh Jain | 30 Jun 10:49 2015
Picon

Mapped diagnostic context

Hello list

I was implementing MDC as per requirement have to pass additional
parameters to the logger.

Can someone help me suggesting best way to implement MDC or any other way
of achieving the requirement.

Thanks,
Ralph Goers | 29 Jun 18:33 2015

Re: Hide *.jar

OK, so you only want to hide hibernate from the stack trace.  Then modify your pattern for the PatternLayout
to include %xEx{full,filters[org.hibernate]}

Ralph

> On Jun 29, 2015, at 9:19 AM, Emi Lu <emilu <at> encs.concordia.ca> wrote:
> 
> Mailing list bounced my email. 
> 
> -------- Forwarded Message --------
> Subject:	Re: Hide *.jar
> Date:	Mon, 29 Jun 2015 12:16:34 -0400
> From:	Emi Lu <emilu <at> encs.concordia.ca> <mailto:emilu <at> encs.concordia.ca>
> Reply-To:	emilu <at> encs.concordia.ca <mailto:emilu <at> encs.concordia.ca>
> To:	log4j-user <at> logging.apache.org <mailto:log4j-user <at> logging.apache.org>
> 
> On 06/29/2015 12:04 PM, Ralph Goers wrote:
>> Can you post the full output of the log event?
>> 
> Here it is. 
> 
> Red lines are the ones I want to hide. 
> 
> 2015-Jun-29 12:10:39.214 [http-8080-5] ERROR DBUtilUser - set gui_model Error: could not extract
ResultSet  SELECT   ****** ORDER BY   1, 2, 3 
> 2015-Jun-29 12:10:39.215 [http-8080-5] ERROR DBUtilUser -
org.hibernate.exception.SQLGrammarException: could not extract ResultSet
> 2015-Jun-29 12:10:39.217 [http-8080-5] ERROR
org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler - Exception occurred during
processing request: could not extract ResultSet
(Continue reading)

Emi Lu | 29 Jun 16:45 2015
Picon
Picon

Hide *.jar

Hello List,

May I know how to hide the following *.jar info please?

     at

org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:123) 
~[hibernate-core-4.3.8.Final.jar:4.3.8.Final]
     at

org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) 
~[hibernate-core-4.3.8.Final.jar:4.3.8.Final]
     at 
org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) 
~[hibernate-core-4.3.8.Final.jar:4.3.8.Final]
     at 
org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:112) 
~[hibernate-core-4.3.8.Final.jar:4.3.8.Final]
     at

org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:91) 
~[hibernate-core-4.3.8.Final.jar:4.3.8.Final]
     at org.hibernate.loader.Loader.getResultSet(Loader.java:2066) 
~[hibernate-core-4.3.8.Final.jar:4.3.8.Final]
     at 
org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1863) 
~[hibernate-core-4.3.8.Final.jar:4.3.8.Final]
     at 
org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1839) 
~[hibernate-core-4.3.8.Final.jar:4.3.8.Final]
(Continue reading)


Gmane