Log4net configuration: can I reference the same layout in multiple applications?

I want to send log messages to several files (i.e. other applications) based on some message property.

The problem is that everyone appendershould specify a fairly detailed one layout(containing the compPattern transform and a couple of converters). I decided to duplicate this configuration in each appender. This works, but not perfect, since it makes the configuration much longer than I would like, as well as the pain of having to update 3 complex bits of the configuration when changing the layout.

I want to be able to define a layout once and all my applications refer to this definition (just as several registrars can refer to the same application). But maybe there is a better way to achieve my goal of reducing duplication in configuration?

My google-foo is weak and I did not find the answer. Can anyone help here?

TIA.

+4
source share
1 answer

Sorry, but if you are not ready to code your own class Layout, there is currently no way to skip the copy configuration.

LayoutSkeleton , ( , log4net )

+2

Source: https://habr.com/ru/post/1541146/


All Articles