Hi,
I do get duplicates.
But with the denys I loose the annotation of the source provided by the
pattern, I guess I can deal with that upstream reproducing the OSGi log
writer configuration with processing in FluentD.
Best Regards
Ian



On 4 February 2016 at 05:27, Chetan Mehrotra <chetan.mehro...@gmail.com>
wrote:

> Not sure but with above setup you might get duplicate logs as both
> appender if attached to same logger would write to console. A better
> way would be to use Logback Appender filter to filter out all message
> effectively disabling those appenders
>
>   <appender name="/logs/error.log"
> class="ch.qos.logback.core.ConsoleAppender">
>     <filter class="ch.qos.logback.classic.filter.LevelFilter">
>       <level>ALL</level>
>       <onMatch>DENY</onMatch>
>       <onMismatch>DENY</onMismatch>
>      </filter>
>   </appender>
> Chetan Mehrotra
>
>
> On Wed, Feb 3, 2016 at 9:34 PM, Ian Boston <i...@tfd.co.uk> wrote:
> > Hi,
> > For completeness for anyone else wanting to use the Docker logger
> > drivers....
> >
> > Starting with
> >  -Dorg.apache.sling.commons.log.configurationFile=logtoconsole.xml
> > where  logtoconsole.xml contains [1], with 1 appender per file in log/*
> > matching the name redirects everything to stdout. The pattern can contain
> > tag to identify the source.
> > Unfortunately there doesn't appear to be a wildcard available on Logback
> to
> > override all possible loggers.
> >
> > Thanks for your help.
> >
> > Best Regards
> > Ian
> >
> >
> > 1
> >
> > <?xml version="1.0"?>
> > <configuration>
> >
> >   <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
> >     <!-- encoders are assigned the type
> >          ch.qos.logback.classic.encoder.PatternLayoutEncoder by default
> -->
> >     <encoder>
> >       <pattern>%d{dd.MM.yyyy HH:mm:ss.SSS} *%level* [%thread] %logger
> > %message%n</pattern>
> >     </encoder>
> >   </appender>
> >
> >   <appender name="/logs/error.log"
> > class="ch.qos.logback.core.ConsoleAppender">
> >      <encoder>
> >        <pattern>error.log %d %-5level %X{sling.userId:-NA} [%thread]
> > %logger{30} %marker- %msg %n</pattern>
> >      </encoder>
> >   </appender>
> >
> > ....
> >
> >   <root level="info">
> >     <appender-ref ref="CONSOLE"/>
> >   </root>
> >
> > <newRule pattern="*/configuration/osgi"
> > actionClass="org.apache.sling.commons.log.logback.OsgiAction"/>
> > <newRule pattern="*/configuration/appender-ref-osgi"
> >
> actionClass="org.apache.sling.commons.log.logback.OsgiAppenderRefAction"/>
> > <osgi/>
> > </configuration>
> >
> >
> >
> > On 3 February 2016 at 13:15, Ian Boston <i...@tfd.co.uk> wrote:
> >
> >> Hi,
> >> Thanks for the pointer, I'll give that a go.
> >> Best Regards
> >> Ian
> >>
> >> On 3 February 2016 at 13:09, Chetan Mehrotra <chetan.mehro...@gmail.com
> >
> >> wrote:
> >>
> >>> As of now you can attach a console appender to ROOT logger so as to
> >>> also redirect the logs to console but it would not be possible to
> >>> disable any other FileAppender. So both appender would remain active.
> >>>
> >>> There are ways to override the OSGi based appenders [1] but that would
> >>> be quite hacky as you would need to do it for each configured
> >>> appender!
> >>>
> >>> To support this case we would need to change the logic to provide such
> an
> >>> option
> >>>
> >>> Chetan Mehrotra
> >>> [1]
> >>>
> https://sling.apache.org/documentation/development/logging.html#configuring-osgi-appenders-in-the-logback-config
> >>>
> >>> On Wed, Feb 3, 2016 at 6:14 PM, Ian Boston <i...@tfd.co.uk> wrote:
> >>> > Hi,
> >>> > Is there a master switch in Sling which I can throw to make all
> logging
> >>> > appear on stdout regardless of the OSGi LogWriter configuration ?
> >>> Hopefully
> >>> > this is already documented.
> >>> >
> >>> > I know that sounds like a dumb thing to do. The stdout in question
> of a
> >>> > Docker container connected to a Docker logging driver that I can
> >>> forward to
> >>> > ELK via FluentD without ever touching the disk. I can categorise the
> >>> stream
> >>> > as it's written so I don't mind that the log lines from multiple
> >>> categories
> >>> > are interlaced as long as they are lines (including stack traces).
> >>> >
> >>> > I would rather treat the Sling instance (Docker container) as a black
> >>> box
> >>> > and not install a specific Logback or SLF4J Logging driver connecting
> >>> > directly to the ELK stack, as there are other applications running
> that
> >>> are
> >>> > black boxes.
> >>> >
> >>> > Best Regards
> >>> > ian
> >>>
> >>
> >>
>

Reply via email to