Veselin M | 19 Apr 11:27 2015

Memory leak by not disposing loggers

Hello all, 

I have a memory leak problem with Log4j2. I’m using SLF4J to get loggers for my objects. Unfortunately
when they get garbage collected the logger remains cached in LoggerContext.loggers in the log4j
framework. Is there any way to prevent the caching or to remove the logger? 

Regards 
Veselin
Ponder Muse | 10 Apr 14:35 2015

log4j2 web lookup questions

Hello,

We have Spring 4 based WAR deployments running on Tomcat 7.0.5x containers
which have just had their log4j2.xml configurations updated to do a
${web:contextPath} lookup in order to use a deployment’s context path as
part of the rolling file’s filename.

We have been able to get log4j2’s web lookups to work but, only after
making two changes in our deployment’s configurations. I list these below:

1) We had to remove org.apache.logging.log4j:log4j-slf4j-impl:2.2 jar from
the deployment’s classpath (but we don't know why this is necessary? We
need this facade for when using 3rd party jars that don't natively work
with log4j2, right!?).

2) We had to include a <display-name>name_here</display-name> entry in the
deployment's web.xml (I read in a Stackoverflow post that the display name
should not be enforced and that it was a bug – not sure if it’s a Tomcat
bug or log4j2 bug however).

Could somebody comment on points 1) and 2)? Particularly point 1) as we
really need to have log4j-slf4j capability in our deployments.

Thanks for any comments/suggestions to these two points.

PM.
Mikael Ståldal | 7 Apr 17:38 2015

Log4j 2 plugin in Scala

Is it possible to write a Log4j 2 plugin in Scala?

Using Log4j 2.2.

--

-- 
[image: MagineTV]

 *Mikael Ståldal*
Senior backend developer

 *Magine TV*
 mikael.staldal <at> magine.com
 Regeringsgatan 25  | 111 53 Stockholm, Sweden  |   www.magine.com

 Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not
copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply
email.
coderbrat | 6 Apr 20:58 2015
Picon

log4j log file not created

This is my log4j.xml and I want to create a log file wws.log either in a
folder where folder path = AE_HOME/logs/ where AE_HOME = "C:/AE/" and
AE_HOME is set as a system variable by another program already.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE log4j:configuration SYSTEM &quot;log4j.dtd&quot;>
    <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
        debug="false">
        <appender name="FILE" class="org.apache.log4j.RollingFileAppender">

            

            

            
            <layout class="org.apache.log4j.PatternLayout">

            </layout>
        </appender>

I also tried using env:AE_HOME in the file path but still I dont find the
log file getting generated anywhere. I tried hard coding the path too, but
still no log file. I have permission to write in the C drive so that's not
an issue.

This is where the logger is being setup in the ServletInit class:

    //initialize log4j
    String log4jConfig =
event.getServletContext().getInitParameter("log4j-config"); // log4jConfig =
(Continue reading)

arjun Sirupa (asirupa | 4 Apr 06:58 2015
Picon

suppress beanutils logging for certain fields


Hello,

In our application, we are using log4j 1.2.17. We use Struts which internally uses beanutils for Login
bean. If log level is set to DEBUG for “org.apache.commons.beanutils” category in log4j.xml, it
prints password in clear text.

In below example, user’s username is “admin” and password is “password”.

DEBUG  [admin-http-pool1][] org.apache.commons.beanutils.ConvertUtils
-::25E5ED4A07F594C9CBDC2C7915D657D2:::- Convert string 'admin' to class 'java.lang.String'

DEBUG  [admin-http-pool1][] org.apache.commons.beanutils.ConvertUtils
-::25E5ED4A07F594C9CBDC2C7915D657D2:::- Convert string ‘password' to class 'java.lang.String'

The security team at our company reported this as a security vulnerability and want us to fix immediately.
Any ideas on how to suppress logging for particular fields ? Or Is there any other alternative ?

Please share your input.

Thanks,
Arjun.

Richard Kolb | 24 Mar 09:12 2015
Picon

Intermittent log file compression issue

Hello,

I am using log4j 2.2 on Windows 2008 using Java 7 and I'm experiencing an
intermittent issue where my log files used to compress, but now just move
to the archive directory uncompressed.

To debug, I changed the file pattern to be on the minute level (in bold),
and I am getting the same issue

Any help would be greatly be appreciated..

thanks,
Richard.

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="TRACE" name="API" packages=""  monitorInterval="30">
    <Appenders>
    <RollingRandomAccessFile name="CatchAll" fileName="logs/all.log"
immediateFlush="false" append="true"
FilePattern="logs/$${date:yyyy-MM}/all-%d{yyyy-MM-dd}-%i.log.gz">
      <PatternLayout>
        <Pattern>%d %m%n</Pattern>
      </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy interval="1" modulate="true" />
                <SizeBasedTriggeringPolicy size="2 GB"/>
            </Policies>
            <DefaultRolloverStrategy max="20"/>
    </RollingRandomAccessFile>
    <RollingRandomAccessFile name="Audit" fileName="logs/audit.log"
(Continue reading)

Mikael Ståldal | 23 Mar 18:40 2015

Strage warning about MessageFactory mismatch

I get the following strange warning from Log4j 2.2:

WARN The Logger MyLogger was created with the message factory
org.apache.logging.log4j.message.MessageFormatMessageFactory <at> 516986e6 and
is now requested with a null message factory (defaults to
org.apache.logging.log4j.message.ParameterizedMessageFactory), which may
create log events with unexpected formatting.

I have these libraries in my classpath:
log4j-1.2-api-2.2.jar
log4j-api-2.2.jar
log4j-core-2.2.jar
log4j-jul-2.2.jar
log4j-slf4j-impl-2.2.jar
slf4j-api-1.7.7.jar

Why do I get this warning? The logging seems to work properly.

--

-- 
[image: MagineTV]

 *Mikael Ståldal*
Senior backend developer

 *Magine TV*
 mikael.staldal <at> magine.com
 Regeringsgatan 25  | 111 53 Stockholm, Sweden  |   www.magine.com

 Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(Continue reading)

Giovanni De Martino | 20 Mar 08:56 2015
Picon

Simplest way to querying multiple collections with similar documents

Hi all,
I've to manage a MongoDb instance used in order to collec application log
entries from several applications servers.

All log entries (mongoDb documents) have the same data structure (id,
timestamp, error_code, message, etc.)
For some requirements specific to my context I need to save this documents
on several different collections on the same MongoDb database.

Which is the way in order to query among all the collections in order, for
example, to find all log entries in a specific interval of time, or with a
specific error_code, etc.?

Currently I'm using MongoDb 2.6 and I'm planning to move to MongoDB 3.0

Many thanks in andvance.
Regards, giovanni

--

-- 
Giovanni De Martino
giovanni.de.martino <at> gmail.com
Dominik Psenner | 19 Mar 20:51 2015
Picon

Apache Con

Dear Apache Logging enthusiast,

In just a few weeks, we'll be holding ApacheCon in Austin, Texas, and we'd
love to have you in attendance. You can save $300 on admission by
registering NOW, since the early bird price ends on the 21st.

Register at http://s.apache.org/acna2015-reg

ApacheCon this year celebrates the 20th birthday of the Apache HTTP Server,
and we'll have Brian Behlendorf, who started this whole thing, keynoting
for us, and you'll have a chance to meet some of the original Apache Group,
who will be there to celebrate with us.

We've got 7 tracks of great talks, as well as BOFs, the Apache BarCamp,
project-specific hack events, and evening events where you can deepen your
connection with the larger Apache community. See the full schedule at
http://apacheconna2015.sched.org/

And if you have any questions, comments, or just want to hang out with us
before and during the event, follow us on Twitter -  <at> apachecon - or drop by
#apachecon on the Freenode IRC network.

Hope to see you in Austin!
Giovanni De Martino | 18 Mar 22:40 2015
Picon

Fwd: Log4j 2.x AsyncLogger

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
giovanni.de.martino <at> gmail.com
jeremy | 9 Mar 23:59 2015
Picon

Question about AsyncAppender vs FailoverAppender

After a quick code inspection it appears that AsyncAppender does not treat
running out of space in its ring buffer as an exception.

If we were to configure AsyncAppender with

blocking false
ignoreExceptions false
and no errorRef

When it runs out of space in the ring buffer it will log an error message,
but not raise an AppenderLoggerException.

Q: Is my understanding of the above accurate?

I understand that intention is to use errorRef to failover to another
appender, however, FailoverAppender offers a much more developed idea of
failover (eg retry interval and multiple failovers) . What's the benefit of
providing errorRef in AsyncAppender rather than simply throwing an
exception when you run out of space in your ring buffer and instructing
users to utilizing FailoverAppender for failover functionality?

Thanks!
-jeremy

Gmane