Mark Lybarger | 6 Mar 15:40 2015
Picon

rolling daily logger

i'm using log4j2 for some of the filters (level and dynamic).  I want my
logs to roll based on size (this makes it easy to open in vim), but also by
date (this helps organize them and I only need 1 week of logs).

here's my current configuraiton. i'm un sure how to specify a rollover
strategy that keeps 7 days worth of files with a size based triggering
policy.

any help would be most appreciated.

thanks,

-mark-


 <Appenders>

    <RollingFile name=*"mlog"* fileName=
*"/home/mark/jboss-eap-6.1/standalone/log/mlog.log"* filePattern=
*"/home/mark/jboss-eap-6.1/standalone/log/mlog-%d{yyyy-MM-dd}.log.%i"*>

      <PatternLayout pattern=*"%d %-5p %X{one} %X{foo} %X{bar} %c{2} -
%m%n"*/>

      <Policies>

                <SizeBasedTriggeringPolicy size=*"50 KB"* />

        </Policies>

(Continue reading)

Robin Jansohn | 4 Mar 13:30 2015
Picon

Parameter isLog4jAutoInitializationDisabled ignored when used alongside log4jConfiguration?

I have a working project to load an external log4j2.xml configuration file in
my webapp. But when I set the context parameter
'isLog4jAutoInitializationDisabled' to disable automatic initialization,
this parameter seems to be ignored. The debug loading messages from log4j2
appear directly after startup and not only while receiving the first
webservice request:

Here's my web.xml:

myWebservice_log4j2.xml:

Is this designed behavior, a mistake in my configuration or a bug?

--
View this message in context: http://apache-logging.6191.n7.nabble.com/Parameter-isLog4jAutoInitializationDisabled-ignored-when-used-alongside-log4jConfiguration-tp54034.html
Sent from the Log4j - Users mailing list archive at Nabble.com.
Mangat Rai | 4 Mar 00:18 2015
Picon

Migrating from log4j 1x to 2x

Hello,
We are using log4j 1x in our application which we want to migrate to log4j 2.
i want to understand few things.
At moment we have a log4j.properties file which we load at the start of application using
PropertyConfigurator method
PropertyConfigurator.configure(log4jPropFileName);
log4j property file looks something like
this
######################################################################log4j.logger.Common.Logger=DEBUG,Common.Loggerlog4j.additivity.Common.Logger=falselog4j.appender.Common.Logger=org.apache.log4j.DailyRollingFileAppenderlog4j.appender.Common.Logger.File=E:\\SoftwareAG\\appLogs\\Common\\common.loglog4j.appender.Common.Logger.layout=org.apache.log4j.PatternLayoutlog4j.appender.Common.Logger.layout.ConversionPattern=%d{yyyy-MM-dd
HH:mm:ss:SSS zzz -} %-5p %m%nlog4j.appender.Common.Logger.DatePattern='.'yyyyMMddlog4j.appender.Common.Logger.MaxFileSize=10MBlog4j.appender.Common.Logger.MaxBackupIndex=10######################################################################
within application we maintain different log files for different functions. 
what i understand from v2 documentation is that i no more need to load configuration at start of application.
Also i understand that i need to change configuration and put them in xml file.
could you guys please help me in understand this? how can i convert my log4j property file to work with new
log4j v2.
Thanks in Advance.
Regards,Mangat Rai
 		 	   		  
Mark Lybarger | 13 Feb 16:33 2015
Picon

logging level per thread

I have a j2ee application that i'd like to change the logging level on a
per thread or a per context basis.  For intstance, I'd like to enable debug
level for user FOO.  Has anyone encountered this ?

Thanks,
-mark-
Tara Czutno | 11 Feb 22:05 2015
Picon

Fwd: Not getting exception stacktrace after upgrading to log4j2 v2.1

We updated our codebase recently from log4j2 v2.0-rc1 to v2.1.  We use a
SocketServer.  Once we did upgraded, we are not seeing exception stack
traces on lines where we used to. For example:
try {
         throw new RuntimeException("Do you now to log my stackTrace?
stringstringstringE");
      } catch (Exception e) {
         LOGGER.error("Do you now to log my stackTrace? a:{} b:{} c:{} Yes,
I do!", "3443","4444","55555",e);
      }
Does not give the stack trace.  Running locally with a test log4j2 config
just writing to a file will give the stack trace.

Any ideas what changed?

We do use slf4j v.1.7.10 but that doesn't seem to be a factor because it
works locally with a test log4j2 config and also with the old SocketServer
and log4j2 v2.0-rc1.

We use a SocketServer so we also had to upgrade to TcpSocketServer.
Perhaps something has changed?

We start our socket server like:

> /usr/bin/java
> -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
> -DgrepToken=org.apache.logging.log4j.core.net.server.TcpSocketServer
> -server -Xms64M -Xmx256M -XX:+UseG1GC -XX:MaxGCPauseMillis=200
> -XX:GCPauseIntervalMillis=400 -Djava.net.preferIPv4Stack=true -cp
> /opt/twc/ecp:/opt/twc/ecp/lib/*
(Continue reading)

Blaine Bergeson (bbergeson | 10 Feb 22:38 2015

Error when date is missing on my RollingRandomAccessFile

I am getting the following error when I remove the date in the file pattern on my RollingRandomAccessFile appender.

Caused by: java.lang.IllegalStateException: Pattern does not contain a date

Here is the appender part of my configuration file:

                    <RollingRandomAccessFile name="RollingRandomAccessFile" fileName="${sys:logDir}/${sys:logFilename}.log"
                                             filePattern="${sys:logDir}/${sys:logFilename}-%i.log">
                        <PatternLayout>
                            <header>${sys:app_title} ${sys:app_version}  ${java:version} - ${java:vm} - ${java:os} - ${java:hw}${sys:newline}</header>
                            <pattern>%d{yyyy-MMM-dd HH:mm:ss.SSS} %-6p [%t] %C{2} %M %m%n</pattern>
                        </PatternLayout>
                        <Policies>
                            <!--OnStartupTriggeringPolicy/-->
                            <TimeBasedTriggeringPolicy/>
                            <SizeBasedTriggeringPolicy size="10 MB"/>
                        </Policies>
                        <DefaultRolloverStrategy min="1" max="3" fileindex="max" />
                    </RollingRandomAccessFile>

If I change the filePattern to the following then it works fine:

                                             filePattern="${sys:logDir}/${sys:logFilename} -%d{yyyy-MM-dd}-%i.log">

According to the documentation I should be able to use a date and/or an index counter.  Has anyone else come
across this before?  I am using the latest release.

Thx Blaine
Honey Goyal | 10 Feb 10:15 2015
Picon

Classloader issue in karaf

I am getting thise error *ERROR StatusLogger Log4j2 could not find a logging
implementation. Please add log4j-core to the classpath. Using SimpleLogger
to log to the console...*

I checked LoaderUtil.java's static block, I found these
*[sun.misc.Launcher$AppClassLoader <at> f4b2263, 
org.apache.logging.log4j.api [65],
sun.misc.Launcher$AppClassLoader <at> f4b2263]* class loader in karaf runtime 
container.

This method tried to find *META-INF/log4j-provider.properties* file in
resources, which it not able to found. That's 
why this *ProviderUtil.hasProviders()* returns false.

I am using log4j-api 2.1 and log4j-core 2.1. Both bundles i have installed
in karaf container.

Any suggestions?

--
View this message in context: http://apache-logging.6191.n7.nabble.com/Classloader-issue-in-karaf-tp53722.html
Sent from the Log4j - Users mailing list archive at Nabble.com.
Sharath Gururaj | 6 Feb 00:29 2015
Picon

log4j2 Jconsole JMX plugin crashes gnome while reconfiguring

Hi All,

I'm trying to reconfigure log4j2 through the provided JMX plugin.
When I click reconfigure button on ubuntu 14.04 It crashes gnome completely.
Nothing is responsive anymore.
Any one else facing this problem?

Thanks
Jason Ricles | 5 Feb 22:47 2015

log4j2.xml sys vs env on Desktop application and in Tomcat Webapp

I have both a dekstop application and a tomcat web application that
write to a log file using log4j2. I also then have the log4j2.xml
configuration file. The file it is writing to is held within a folder
that as stored as an environment variable. The log4j2.xml file thus
looks like this,

<?xml version="1.0" encoding="UTF-8"?>

<Configuration status="WARN" monitorInterval="30">

    <Properties>

        <Property name="logdir">${env:FOO}/log</Property>

        <Property name="msgformat">%d{yyyy-MM-dd HH:mm:ss.SSS}{GMT+0}
[%t] %-5level %logger{36} - %msg%n</Property>

    </Properties>

    <Appenders>

        <Console name="Console" target="SYSTEM_OUT">

            <PatternLayout pattern="${msgformat}"/>

        </Console>

        <RollingFile name="ERROR_FILE" fileName="${logdir}/error.log"

            filePattern="${logdir}/error-%i.log">
(Continue reading)

Gary Gregory | 5 Feb 14:22 2015
Picon

Re: Why RollingFileAppender do not work by size on WebLogic 10.3.3 with Log4J 1.2.16 and jdk 1.6.0_33?

So it looks like a problem with Jackson and/or Stax2... let us know what
you find.

Gary

On Wed, Feb 4, 2015 at 10:01 AM, Jordán E Moisés <
jordan.moises <at> kennen-consulting.com> wrote:

>
> By the page "
> http://logging.apache.org/log4j/2.x/log4j-core/dependencies.html#Dependency_Tree
> "
>
> This is an extract of it
>
> ---------------------------------------------
>
> Project Dependencies
> compile
>
> The following is a list of compile dependencies for this project. These
> dependencies are required to compile and run the application:
> GroupId                                 ArtifactId
> Version Type
> org.apache.logging.log4j                log4j-api
>  2.1             jar
> com.fasterxml.jackson.core              jackson-core            2.4.2
>      jar
> com.fasterxml.jackson.core              jackson-databind
> 2.4.2           jar
(Continue reading)

Gary Gregory | 4 Feb 14:10 2015
Picon

Re: Why RollingFileAppender do not work by size on WebLogic 10.3.3 with Log4J 1.2.16 and jdk 1.6.0_33?

This looks worrisome:

Caused by: java.lang.
UnsupportedOperationException: Not implemented

You could have the wrong version of some jars on your classpath.

Which is what the JIRA issue
https://issues.apache.org/jira/browse/LOG4J2-739 discusses.

You need to debug your classpath and compare what you end up with vs. what
Log4j expects.

Gary


On Tue, Feb 3, 2015 at 6:25 PM, Jordán E Moisés <
jordan.moises <at> kennen-consulting.com> wrote:

> Remko:
>
>         I tried, but I have a problem with XMLLayout for RollingFile; I
> see that there is an issue reported ([jira] [Commented] (LOG4J2-739)
> XMLLayout no out put, and Error). Is there any solution for this?
>
>
> -------------------------------
> JDK:
> -------------------------------
>
(Continue reading)


Gmane