Arbitrary text formats are already supported in Chainsaw -files can be
tailed locally or remotely (ssh) via a receiver that leverages Commons
VFS:

https://logging.apache.org/chainsaw/2.x/apidocs/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.html

The receiver supports the common pattern layout fields (timestamp,
level, thread, message, etc) and supports custom properties as well.

Example pattern that'll parse a log line:

<param name="logFormat" value="LEVEL TIMESTAMP PROP(CONTEXT) [THREAD]
LOGGER: MESSAGE"/>
                <param name="timestampFormat" value="yyyy-MM-dd HH:mm:ss,SSS"/>

It also supports the 2-line java.util.logging stuff, as well as custom
level definitions (think Android logcat single-char levels).

Scott

On 6/18/21, Ralph Goers <ralph.go...@dslextreme.com> wrote:
>
>
>> On Jun 18, 2021, at 10:40 AM, Matt Sicker <boa...@gmail.com> wrote:
>>
>> A couple other common log collection setups I've come across over time:
>>
>> * Logging to stdout/stderr in a standard format, then use a log
>> collection API from your orchestration engine (common in the
>> Kubernetes world to avoid logging to a file).
>
> NOT recommended for use with Log4j. See
> http://logging.apache.org/log4j/2.x/manual/cloud.html.
>
>> * Logging to a log file as normal, but running a log forwarding agent
>> alongside (e.g., Splunk, Logstash).
>> * Logging to syslog (typically more important for auditing and
>> security related logs)
>>
>> For the log format itself, JSON template layouts work great here for
>> customizing how much info you need in your logs. It also makes it much
>> easier to create log indices in various log searching products. Which
>> particular one hasn't been as important in my experience as trying to
>> stay consistent.
>>
>
> I happen to like GELF as it neatly solves the problem of Java Exceptions
> having newlines in them. Other formats that use the newline to delimit the
> end of the message require weird rules to be set up in Logstash to glue
> the various lines back together again. Invariably some message will violate
>
> the assumptions the rules are based on.
>
> Ralph
>
>
>

Reply via email to