Coder Social home page Coder Social logo

Comments (3)

7max avatar 7max commented on June 22, 2024

Yes the log messages are filtered against log level once at the point of
entry, and then are propagated to parents.

Perhaps /additivity/ functionality can help you implement what you want?

A logger that is set as non-additive, does not forward messages to parent
loggers at all. (These are intended for big packages that want to have their
own log files).

For example if you set your search-tips and e-shop loggers as non-additive, none of
their messages will appear in appenders attached to the root logger.

You can set them non-additive by adding :own or :noadditive flag to (log:config)
in the same place where you add the rolling file appender.

If that is not flexible enough, then what you want is to have an appender that
filters on log level. Interestingly enough Log4J has this functionality but
since I never used it personally nor known anyone who used it, I thought it
was over-design and did not implement it in log4cl.

Regards,
Max

At Fri, 23 Aug 2013 03:18:15 -0700,
naryl wrote:

I have several packages with different log levels writing to different files and I create a file appender for root logger which
should write all ERROR messages from all loggers to error.log. Currently messages are only filtered by the logger they're
initiated at so if one package's logger is set to DEBUG root logger would write debug messages to error.log even if it's set to
ERROR.

Here's my (log:config)

ROOT, ERROR
|
+-(1)-#<DAILY-FILE-APPENDER {131D9559}>
| with #<PATTERN-LAYOUT {EC39B39}>
| :conversion-pattern
| "%&%<{nopretty}%I%;<;;>;-5p [%D{%H:%M:%S}] %g{}{}{:downcase} (%C{}{ }{:downcase})%2.2N - %:%m%>%n"
| :immediate-flush NIL
| :flush-interval 1
| :stream-owner T
| :rollover-check-period 60
| :name-format #P"/home/naryl/eshop-logs/eshop.log"
| :backup-name-format NIL
| :utc NIL
| :message-count 2962
|
+-ESHOP, DEBUG
| |
| +-(1)-#<THIS-CONSOLE-APPENDER {131E4B31}>
| with #<PATTERN-LAYOUT {BB97C89}>
| :conversion-pattern
| "%&%<{nopretty}%I%;<;;>;-5p [%D{%H:%M:%S}] %g{}{}{:downcase} (%C{}{ }{:downcase})%2.2N - %:
%m%>%n"
| :immediate-flush NIL
| :flush-interval 1
| :stream-owner NIL
| :stream #<SB-SYS:FD-STREAM for "the terminal" {B322409}>
| :message-count 2962
|
+-SEARCH-TIPS, TRACE
|
+-(1)-#<DAILY-FILE-APPENDER {11BC4DE9}>
with #<PATTERN-LAYOUT {11BC2651}>
:conversion-pattern
"%&%<%I%;<;;>;-5p [%D{%H:%M:%S}] %g{}{}{:downcase}%:; ;F (%C{}{ }{:downcase})%2.2N - %:_%m%>%n"
:immediate-flush NIL
:flush-interval 1
:stream-owner T
:rollover-check-period 60
:name-format "/home/naryl/eshop-logs/search-tips.log"
:backup-name-format NIL
:utc NIL
:message-count 0


Reply to this email directly or view it on GitHub.*

from log4cl.

naryl avatar naryl commented on June 22, 2024

Ok, mark it invalid. I'll write a level-filtering appender.

from log4cl.

7max avatar 7max commented on June 22, 2024

Cool, it should be a one liner :around method for APPENDER-DO-APPEND for a quick fix.

If you happen to implement a larger patch, with LOG:CONFIG hookup for it, I
would gladly merge it, something like. (LOG:CONFIG ...stuff that adds an
appender... :filter :error). Adding a filter slot to base appender class is
good too, making it NIL by default.

At Fri, 23 Aug 2013 04:28:21 -0700,
naryl wrote:

[1 <text/plain; UTF-8 (7bit)>]

[2 <text/html; UTF-8 (7bit)>]
Ok, mark it invalid. I'll write a level-filtering appender.


Reply to this email directly or view it on GitHub.*

from log4cl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.