Nipuni Piyabasi Perera | 12 Feb 12:56 2016
Picon
Gravatar

Log file location for SysLogAppender

Hi all,

I am trying connect to a sysLogAppender with log4j2. Please find my log4j2
configuration below.

<Syslog name="bsd" host="localhost" port="514" protocol="TCP"/>

Initially I could see an error when starting my server as [1]. I could
solve that issue after uncommenting the lines [2] in /etc/rsyslog.conf. I
don't see any errors while starting my server now.
I need to know the location where my logs write to?

[1] ERROR An exception occurred processing Appender bsd
org.apache.logging.log4j.core.appender.AppenderLoggingException: Error
writing to TCP:localhost:514 socket not available
[2] $ModLoad imtcp
     $InputTCPServerRun 514

Thanks,
Nipuni

--

-- 
Nipuni Perera
Software Engineer; WSO2 Inc.; http://wso2.com
Email: nipuni <at> wso2.com
Git hub profile: https://github.com/nipuni
Blog : http://nipunipererablog.blogspot.com/
Mobile: +94 (71) 5626680
Melissa Warnkin | 11 Feb 19:23 2016

ApacheCon NA 2016 - Important Dates!!!

 Hello everyone!
I hope this email finds you well.  I hope everyone is as excited about ApacheCon as I am!
I'd like to remind you all of a couple of important dates, as well as ask for your assistance in spreading the
word! Please use your social media platform(s) to get the word out! The more visibility, the better
ApacheCon will be for all!! :)
CFP Close: February 12, 2016CFP Notifications: February 29, 2016Schedule Announced: March 3, 2016
To submit a talk, please visit:  http://events.linuxfoundation.org/events/apache-big-data-north-america/program/cfp

Link to the main site can be found here:  http://events.linuxfoundation.org/events/apache-big-data-north-america

Apache: Big Data North America 2016 Registration Fees:
Attendee Registration Fee: US$599 through March 6, US$799 through April 10, US$999
thereafterCommitter Registration Fee: US$275 through April 10, US$375 thereafterStudent
Registration Fee: US$275 through April 10, $375 thereafter
Planning to attend ApacheCon North America 2016 May 11 - 13, 2016? There is an add-on option on the
registration form to join the conference for a discounted fee of US$399, available only to Apache: Big
Data North America attendees.
So, please tweet away!!
I look forward to seeing you in Vancouver! Have a groovy day!!
~Melissaon behalf of the ApacheCon Team

Chris Nauroth | 10 Feb 22:20 2016
Gravatar

Log4J 2 configuration: parameterizing appender via environment variable

Hello Log4J community,

I'm currently investigating possible migration from Log4J 1 to Log4J 2 for
Apache ZooKeeper.  For full context, please see Apache JIRA issue
ZOOKEEPER-2342 [1].  I'm struggling with how to preserve one particular
capability that we have already given to administrators for controlling
their logging settings.  I can't find a way to achieve the same thing in
Log4J 2, and I'd like to get your advice.

The ZooKeeper launch scripts support controlling the root logger by
setting an environment variable named ZOO_LOG4J_PROP.  The value gets
passed to the launched process as a -Dzookeeper.root.logger argument [2]:

    nohup "$JAVA" $ZOO_DATADIR_AUTOCREATE
"-Dzookeeper.log.dir=${ZOO_LOG_DIR}" \
    "-Dzookeeper.log.file=${ZOO_LOG_FILE}"
"-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
    -XX:+HeapDumpOnOutOfMemoryError -XX:OnOutOfMemoryError='kill -9 %p' \
    -cp "$CLASSPATH" $JVMFLAGS $ZOOMAIN "$ZOOCFG" > "$_ZOO_DAEMON_OUT"
2>&1 < /dev/null &

We have a Log4J 1 log4j.properties file that includes a default value for
zookeeper.root.logger in case it is unspecified at process launch, and
then the variable gets substituted into the declaration of
log4j.rootLogger [3]:

zookeeper.root.logger=INFO, CONSOLE
...
log4j.rootLogger=${zookeeper.root.logger}

(Continue reading)

Tara Czutno | 9 Feb 02:00 2016
Picon

Errors with FlumeAppender

I am trying out Flume, but I am getting an error:
2016-02-08 17:52:46,368 main DEBUG Shutdown hook enabled. Registering a new
one.
2016-02-08 17:52:46,370 main DEBUG LoggerContext[name=504bae78,
org.apache.logging.log4j.core.LoggerContext <at> 5824a83d] started OK.
2016-02-08 17:52:46,388 main ERROR Recursive call to appender flume
2016-02-08 17:52:46,394 main ERROR Recursive call to appender flume
2016-02-08 17:52:46,464 main ERROR Recursive call to appender flume
2016-02-08 17:52:46,464 main ERROR Recursive call to appender flume

Flume output:

2016-02-08 17:46:51,334 (conf-file-poller-0) [DEBUG -
org.apache.flume.conf.FlumeConfiguration$AgentConfiguration.isValid(FlumeConfiguration.java:372)]
Post validation configuration for agent

AgentConfiguration created without Configuration stubs for which only basic
syntactical validation was performed[agent]

SOURCES: {avroSrc={ parameters:{bind=localhost, channels=memoryChannel,
port=8800, type=avro} }}

CHANNELS: {memoryChannel={ parameters:{type=memory, capacity=100} }}

AgentConfiguration created with Configuration stubs for which full
validation was performed[agent]

SINKS: {loggerSink=ComponentConfiguration[loggerSink]

  CONFIG:
(Continue reading)

Tara Czutno | 8 Feb 21:16 2016
Picon

Fastest Log4j2 configuration for multiple java process / multiple machine production environment

We have 4 java processes running on machine01, 1 java process on machine02,
2 java processes on machine03.  We would like them to all write logging to
the same file on machine01.  What is the best config to accomplish
this?  We need production grade very fast high throughput logging.

Right now we have a 5th process on machine01, ecplogger, that runs the
UdpSocketServer and uses RollingRandomAccessFile Appender wrapped with
Failover Appender.  All other processes on machine01, machine02 and
machine03 write to a Socket Appender wrapped with an Async appender wrapped
with a Failover Appender.

It works sort of, however I get these errors in the main java process on
machine01 and I get lots of logging to the Failover appender:

2016-02-05 18:23:06,123 AsyncAppender-local_process_async ERROR Unable to
write to stream UDP:ecplogger:6000 for appender local_process_socket

2016-02-05 18:34:50,746 AsyncAppender-local_process_async ERROR Unable to
write to stream UDP:ecplogger:6000 for appender local_process_socket

2016-02-05 18:47:25,233 Log4j2-AsyncLogger[AsyncContext <at> 18b4aac2]1 ERROR
Appender local_process_async is unable to write primary appenders. queue is
full

2016-02-05 18:47:25,234 Log4j2-AsyncLogger[AsyncContext <at> 18b4aac2]1 ERROR
Appender local_process_async is unable to write primary appenders. queue is
full

2016-02-05 18:47:25,235 Log4j2-AsyncLogger[AsyncContext <at> 18b4aac2]1 ERROR
Appender local_process_async is unable to write primary appenders. queue is
(Continue reading)

Gary Gregory | 8 Feb 18:17 2016
Picon
Gravatar

New traceEntry code

Hi All:

The pattern I've had to implement for our product is close to what this
does, but not quite, so I'd like to propose changes.

The key part is for the new traceEntry methods to return the String message
it built so I can reuse it in the traceExit() call. This is how I do it now:

public int doFoo(int a, int b) {
  final String method = traceEntry("doFoo(a=%,d, b=%,d", a, b);
  // do Foo impl
  int result = ...
  return traceExit(method, result);
}

This allows the Entry/Exit log events to match nicely, especially in our
multi-threaded use cases. It's easier to tell which exit matches which
entry. You do not want to compute the method String more than once of
course.

(I use the String.format() message factory to get nice looking numbers, and
so on. We allow that to be set up at the logger level, which is nice.)

I've had to cookup my own my own traceEntry/traceExit, otherwise the code
would be logger.traceEntry(...).

The verbiage I use is also different: I use a verb: "Enter", as opposed to
the noun "entry", which looks really weird in English to me. "Entry
methodName"? That does not sound good to me "Entry of methodName" OK. For
me it's "Enter methodName..." and "Exit methodName". Sentences start with a
(Continue reading)

Apostolis Giannakidis | 4 Feb 16:07 2016
Picon
Gravatar

Testing TimeBasedTriggeringPolicy behavior

Hello all,

My Logger uses a RollingFileAppender with a TimeBasedTriggeringPolicy.

The file pattern is set to:
logfile.log.%d{yyyy-MM-dd}

I would like to write automated functional tests that use the logger and
verify that the rolling of the file is performed according to the expected
behavior of the TimeBasedTriggeringPolicy.

In other words, I'd like to write a system test that does something like
the following:
1) start the system (assuming that the current date is 2016-02-4)
2) log a message. This message will be written to logfile.log.
3) Verify that the message was logged to logfile.log.
4) Force the log file to rotate.
5) Verify that the file logfile.log.2016-02-05 was created with the correct
contents.
6) log a message. This message will be written to logfile.log.
7) Verify that the message was logged to logfile.log.

Is there any way that I could perform step #4?

One way that I was thinking of is if I could use my own implementation of
the LogEvent that would return a fake event time for each event.

What are your thoughts?

Thank you very much.
(Continue reading)

Nipuni Piyabasi Perera | 3 Feb 14:07 2016
Picon
Gravatar

Custom appender not identified in OSGi environment

Hi,

I have written a custom appender extending the log4j2 AbstractAppender. But
I am getting a runtime error[1]. I have added the plugin annotation[2] as
per the manual and the custom appender class contains factory method
createAppender() as well. I also have added the package name to
configuration element.
What am I missing here? Appreciate any input on this.

I have my log4j2.xml file as below:

<Configuration packages="org.my.custom.http.socket.appender">
    <Appenders>
        ...
        <Socket name="socket" host="localhost" port="4714">
      <!--PatternLayout pattern="[%d] %5p {%c} - %m%ex%n"/-->
    </Socket>
        <HTTPSocket name="HTTP_APPENDER" host="localhost" port="8888">
   <-------------------------------------
New Appender
    </HTTPSocket>
    </Appenders>
    <Loggers>
        <Root level="info" includeLocation="true">
            ...
            <AppenderRef ref="HTTP_APPENDER"/>
        </Root>
        <Logger name="my.custom.deployer" level="info" additivity="true">
                <AppenderRef ref="socket"/>
    </Logger>
(Continue reading)

Veit Guna | 3 Feb 09:47 2016
Picon
Picon

RollingRandomAccessFile and emtpy log file

Hi.

I'm using log4j 2.5 with the RollingRandomAccessFile. When the application starts up and performs
logging, the logfile
gets created, but nothing is written to it. Only after I stop the application the content appears. I also
doublechecked the 256KB
buffer. But logging 600KB doesn't seem to trigger a write to the file. Console appender is working fine.

Any idea what I'm missing?

Here's my configuration:

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

    <Properties>
        <Property name="logsPath">${sys:app.logs:-${env:APP_LOGS:-logs}}</Property>
    </Properties>

    <Appenders>
        <RollingRandomAccessFile name="rollingFileAppender" fileName="${logsPath}/app.log"
filePattern="${logsPath}/app-%d{yyyy-MM-dd}-%i.log" immediateFlush="false">
            <PatternLayout>
                <pattern>%d %-5p [%mdc{RQID}] [%c{1}] - %m%n</pattern>
            </PatternLayout>
            <Policies>
                <SizeBasedTriggeringPolicy size="10 MB" />
            </Policies>
            <DefaultRolloverStrategy max="5" />
(Continue reading)

Nipuni Piyabasi Perera | 1 Feb 14:06 2016
Picon
Gravatar

Customizing log messages with log4j2

Hi all,

I am working on adding some new log parameters to my log messages. I could
read that log4j2 provide the option to add new Converters without extending
PatternLayout. I have tried out a sample custom PatternConverter in my OSGi
environment. I got the error below, which is already reported in [1].
I haven't tried extending the patternLayout yet to address my requirement.
What is the recommended way with log4j2 to customize logging information?
Can we continue extending the patternLayout with log4j2 too?

2016-02-01 18:08:20,794 ERROR Unrecognized format specifier [hostname]
2016-02-01 18:08:20,794 ERROR Unrecognized conversion specifier [hostname]
starting at position 28 in conversion pattern.

[1] https://issues.apache.org/jira/browse/LOG4J2-954

Thanks,
Nipuni

--

-- 
Nipuni Perera
Software Engineer; WSO2 Inc.; http://wso2.com
Email: nipuni <at> wso2.com
Git hub profile: https://github.com/nipuni
Blog : http://nipunipererablog.blogspot.com/
Mobile: +94 (71) 5626680
Matt Sicker | 29 Jan 22:27 2016
Picon
Gravatar

Where is it documented that you can supply a Throwable in a varargs log message?

Like when you do logger.debug("{}", foo, ex). I know it's supported, but I
can't find anywhere that this is mentioned.

--

-- 
Matt Sicker <boards <at> gmail.com>

Gmane