Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Hello, this is a Log4J2 appender experiment #38

Merged
merged 4 commits into from Jan 20, 2015

Conversation

joshuadavis
Copy link

Thought I'd make a Log4J2 appender for Logentries, since I'm using Log4J2.

@joshuadavis joshuadavis reopened this Nov 15, 2014
@apiraino
Copy link

Hello,

any news concerning this pull request?
I've been keeping an eye on this because it would be nice to have it for a project I'm working on.
I'd like to link Logentries but I'm using Log4j2. Else I need to find another way of logging without Logentries.

thanks

@joshuadavis
Copy link
Author

I haven't heard anything yet, but I'm using this code in production and it seems to be working well.

@raupachz
Copy link
Contributor

Unfortunately there is not much feedback from the Logentries Team. I also wrote a Logentries appender, however for JUL. Its running in production for months without any troubles.

@samjamesobrien
Copy link
Contributor

Sorry this was not evaluated sooner guys, I am going to have a look at the open pull requests for this library in the coming days.

@joshuadavis
Copy link
Author

Great!

@apiraino
Copy link

👍

samjamesobrien pushed a commit that referenced this pull request Jan 20, 2015
@samjamesobrien samjamesobrien merged commit 326f8cd into rapid7:master Jan 20, 2015
@samjamesobrien
Copy link
Contributor

👍

@samjamesobrien
Copy link
Contributor

@joshuadavis could you provide a sample configuration to include in the logging library?

@samjamesobrien
Copy link
Contributor

@joshuadavis disregard, I put one together.

@joshuadavis
Copy link
Author

Okay, great! It's pretty straightforward.



On Mon, Feb 2, 2015 at 1:44 PM, samjamesobrien notifications@github.com
wrote:

@joshuadavis https://github.com/joshuadavis disregard, I put one
together.


Reply to this email directly or view it on GitHub
#38 (comment).

@apiraino
Copy link

apiraino commented Feb 2, 2015

My log4j2xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
    <properties>
        <property name="logPath">/tmp/</property>
        <property name="logFileName">MyLogFile.log</property>
        <property name="logRollingFileName">MyLogFile-rolling.log</property>
        <property name="pattern">%d %-5p [%t] %C{2} (%F:%L) - %m%n</property>
    </properties>
    <Appenders>
        <Console name="STDOUT" target="SYSTEM_OUT">
            <PatternLayout pattern="${pattern}"/>
        </Console>
        <File name="MyAgentLog" fileName="${pattern}${logFileName}">
            <PatternLayout pattern="${pattern}"/>
        </File>
        <Logentries name="le"
                     token="${env:LOGENTRIES_TOKEN}"
                     debug="false">
            <PatternLayout pattern="${pattern}"/>
        </Logentries>
        <RollingFile name="roll"
                     fileName="${logPath}${logRollingFileName}"
                     filePattern="${logPath}${logRollingFileName}-%i.log.gz">
            <PatternLayout pattern="${pattern}" />
            <Policies>
                <SizeBasedTriggeringPolicy size="10 MB"/>
            </Policies>
        </RollingFile>
    </Appenders>
    <Loggers>
        <Logger name="org.apache.log4j.xml" level="info"/>
        <Root level="debug">
            <AppenderRef ref="le"/>
        </Root>
    </Loggers>
</Configuration>

The Logentries token is set from ENV, e.g.:
export LOGENTRIES_TOKEN=AAABBBCCC

You have four appenders available: console, File, RollingFile, Logentries. Only Logentries ("le") is enabled.

@samjamesobrien
Copy link
Contributor

Thanks guys, I will include these in the sample files.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
5 participants