[logback-user] logback-user Digest, Vol 126, Issue 5

Thomas Schittli Thomas.Schittli at jig.ch
Wed Aug 31 15:17:27 CEST 2022


Thank you **very** much, Ceki Gülcü, for your support:

    Hi Thomas,
    SiftingAppender is probably what you are looking for.
    https://logback.qos.ch/manual/appenders.html#SiftingAppender
    --
    Ceki Gülcü


it works perfectly and is quite great 😊

Thanks a lot, kind regards,
Thomas


-----Original Message-----
From: logback-user <logback-user-bounces at qos.ch> On Behalf Of logback-user-request at qos.ch
Sent: Wednesday, August 31, 2022 12:00 PM
To: logback-user at qos.ch
Subject: logback-user Digest, Vol 126, Issue 5

Send logback-user mailing list submissions to
	logback-user at qos.ch

To subscribe or unsubscribe via the World Wide Web, visit
	http://mailman.qos.ch/mailman/listinfo/logback-user
or, via email, send a message with subject or body 'help' to
	logback-user-request at qos.ch

You can reach the person managing the list at
	logback-user-owner at qos.ch

When replying, please edit your Subject line so it is more specific than "Re: Contents of logback-user digest..."


Today's Topics:

   1. Logback FileAppender question: is it able to create log
      filenames dynamically by a string passed e.g. in LOGGER.trace()?
      (Thomas Schittli)
   2. Re: Logback FileAppender question: is it able to create log
      filenames dynamically by a string passed e.g. in LOGGER.trace()?
      (Ceki Gülcü)


----------------------------------------------------------------------

Message: 1
Date: Tue, 30 Aug 2022 12:59:56 +0000
To: "logback-user at qos.ch" <logback-user at qos.ch>
Subject: [logback-user] Logback FileAppender question: is it able to
	create log filenames dynamically by a string passed e.g. in
	LOGGER.trace()?
Message-ID:
	<DB7PR04MB44577D12DBC68188909E3C13BD799 at DB7PR04MB4457.eurprd04.prod.outlook.com>
	
Content-Type: text/plain; charset="utf-8"

Good afternoon

The documentation for SLF4J and Logback is very detailed 😊, but unfortunately it is still difficult to understand the various possibilities and mechanisms, so I have a question:

Is it possible to configure the logback FileAppender so that it automatically / dynamically creates logfile names based on a string which the developer passes in e.g. LOGGER.trace()?

The background to the idea is as follows:


  1.  The developer is programming a new module (e.g. a configuration manager) and he would like to have the log entries summarised in a separate log file.

  2.  Therefore, he calls something like that: LOGGER.trace(“Config-Mgr”, “Message”)

  3.  SLF4J / Logback automatically reads this string and create this Logfile: AppLog-Config-Mgr.log


  4.  The central element is that we do not have to modify logback.xml and create an appender for each Logfile.

This means that if the user now calls e.g.: LOGGER.trace(“User-Actionlog”, “Message”) then this new log file will created without having to modify logback.xml:
AppLog-User-Actionlog.log



Thank you very much for any tips & tricks 😊

Thanks a lot, kind regards,
Thomas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20220830/4df874c5/attachment-0001.html>

------------------------------

Message: 2
Date: Tue, 30 Aug 2022 21:26:44 +0200
To: logback-user at qos.ch
Subject: Re: [logback-user] Logback FileAppender question: is it able
	to create log filenames dynamically by a string passed e.g. in
	LOGGER.trace()?
Message-ID: <5b9c4fee-2451-bcc7-f9ad-c0af38e48a73 at qos.ch>
Content-Type: text/plain; charset=UTF-8

Hi Thomas,

SiftingAppender is probably what you are looking for.

https://logback.qos.ch/manual/appenders.html#SiftingAppender
--
Ceki Gülcü

Sponsoring SLF4J/logback/reload4j at https://github.com/sponsors/qos-ch


On 8/30/2022 2:59 PM, Thomas Schittli wrote:
> Good afternoon
> 
>  
> 
> The documentation for SLF4J and Logback is very detailed 😊, but 
> unfortunately it is still difficult to understand the various 
> possibilities and mechanisms, so I have a question:
> 
>  
> 
> Is it possible to configure the logback FileAppender so that it 
> automatically / dynamically creates logfile names based on a string 
> which the developer passes in e.g. LOGGER.trace()?
> 
>  
> 
> The background to the idea is as follows:
> 
>  
> 
>  1. The developer is programming a new module (e.g. a configuration manager)
>     and he would like to have the log entries summarised in a separate
>     log file.
> 
>  2. Therefore, he calls something like that: LOGGER.trace(“Config-Mgr”,
>     “Message”)
> 
>  3. SLF4J / Logback automatically reads this string and create this
>     Logfile: AppLog-Config-Mgr.log
> 
> 
>  4. The central element is that we do not have to modify logback.xml and
>     create an appender for each Logfile.
> 
>     This means that if the user now calls e.g.:
>     LOGGER.trace(“User-Actionlog”, “Message”)
>     then this new log file will created without having to modify
>     logback.xml:
>     AppLog-User-Actionlog.log
> 
>  
> 
> 
> Thank you very much for any tips & tricks 😊
> 
> Thanks a lot, kind regards,
> Thomas
> 
>  


------------------------------

Subject: Digest Footer

_______________________________________________
logback-user mailing list
logback-user at qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-user

------------------------------

End of logback-user Digest, Vol 126, Issue 5
********************************************


More information about the logback-user mailing list