mercredi 2 septembre 2020

Add new parameters to Logback pattern

I am using Java logback in my system. the pattern of the log is defined is follow:

        <encoder>
            <pattern>D:%d{yyyy-MM-dd HH:mm:ss.SSS} L:%p C:%c{1} F:%F\(%L\) Fn:%M T:%thread R:%X{R} - %m%n</pattern>
        </encoder>

I would like to add 2 parameters which are not defined Logback conversion word table. For example I would like to add Category parameter which can be one of: configuration,System, Security etc.. and another parameter which can be name of the application which create the log and could be any name. What is the best way to add these parameters to my Log format?

Aucun commentaire:

Enregistrer un commentaire