logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bilguun Ariunbold <ariunboldbilig...@gmail.com>
Subject Re: How to create the custom marker in log4j2/slf4j?
Date Wed, 16 Mar 2016 03:34:58 GMT
Thank you for your responses. Sorry about the noise, it's working as
expected now, it seems like the problem was jar files, I deleted all jars
and ran mvn build again.

On Tuesday, March 15, 2016, Ralph Goers <ralph.goers@dslextreme.com> wrote:

> ?
>
> It looks like he is using the SLF4J API and wants that routed to Log4j.
> Assuming he has the correct jars this should work.
>
> Ralph
>
> > On Mar 15, 2016, at 1:09 PM, Gary Gregory <garydgregory@gmail.com
> <javascript:;>> wrote:
> >
> > I need a Log4j marker, please see org.apache.logging.log4j.MarkerManager
> >
> > Gary
> >
> > On Tue, Mar 15, 2016 at 12:12 PM, Bilguun Ariunbold <
> > ariunboldbiliguun@gmail.com <javascript:;>> wrote:
> >
> >> down votefavorite
> >> <
> >>
> https://stackoverflow.com/questions/36018016/how-to-create-the-custom-marker-in-slf4j-log4j2#
> >>>
> >>
> >> I am trying to create custom marker using slf4j and log4j2. Below is
> how I
> >> created the marker and used it:
> >>
> >> Marker marker =
> >> org.slf4j.MarkerFactory.getMarker("WebService");logger.info(marker,
> >> "service called");
> >>
> >> And below is my log4j2-test.xml:
> >>
> >> <?xml version="1.0" encoding="UTF-8"?>
> >> <Configuration status="DEBUG">
> >>    <Properties>
> >>        <Property name="layout">%d | %-5p | [%t] | %c{2} | %M |
> >> %m%n</Property>
> >>    </Properties>
> >>    <Appenders>
> >>        <File name="WebServices"
> >> fileName="${sys:user.home}/logs/service_requests.log">
> >>            <MarkerFilter marker="WebService" onMatch="ACCEPT"
> >> onMismatch="DENY" />
> >>            <JSONLayout>
> >>            </JSONLayout>
> >>        </File>
> >>    </Appenders>
> >>    <Loggers>
> >>        <Root level="TRACE">
> >>            <AppenderRef ref="WebServices" level="INFO" />
> >>        </Root>
> >>    </Loggers>
> >> </Configuration>
> >>
> >> It created the file but does not write anything to it. Did I miss
> >> something? thank you
> >>
> >
> >
> >
> > --
> > E-Mail: garydgregory@gmail.com <javascript:;> | ggregory@apache.org
> <javascript:;>
> > Java Persistence with Hibernate, Second Edition
> > <http://www.manning.com/bauer3/>
> > JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> > Spring Batch in Action <http://www.manning.com/templier/>
> > Blog: http://garygregory.wordpress.com
> > Home: http://garygregory.com/
> > Tweet! http://twitter.com/GaryGregory
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> <javascript:;>
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> <javascript:;>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message