c# - log4net: different info colors for different types -
i have log4net , want have different info colors different types (for 2 special types) in same assembly. possible? if possible should do?
thanks in advance.
update: appender supposed coloredconsoleappender.
i think looking for
<log4net> <appender name="common" type="log4net.appender.coloredconsoleappender"> <filter type="log4net.filter.loggermatchfilter"> <loggertomatch value="custom1" /> <acceptonmatch value="false" /> </filter> <filter type="log4net.filter.loggermatchfilter"> <loggertomatch value="custom2" /> <acceptonmatch value="false" /> </filter> <layout type="log4net.layout.patternlayout"> <conversionpattern value="%date [%thread] %-5level %logger [%property{ndc}] - %message%newline" /> </layout> </appender> <appender name="custom1" type="log4net.appender.coloredconsoleappender"> <mapping> <level value="info" /> <backcolor value="blue" /> </mapping> <layout type="log4net.layout.patternlayout"> <conversionpattern value="%date [%thread] %-5level %logger [%property{ndc}] - %message%newline" /> </layout> </appender> <appender name="custom2" type="log4net.appender.coloredconsoleappender"> <mapping> <level value="info" /> <backcolor value="light blue" /> </mapping> <layout type="log4net.layout.patternlayout"> <conversionpattern value="%date [%thread] %-5level %logger [%property{ndc}] - %message%newline" /> </layout> </appender> <root> <level value="info" /> <appender-ref ref="common"/> </root> <logger name="namespace.foo"> <level value="info" /> <appender-ref ref="custom1" /> </logger> <logger name="namespace.bar"> <level value="info" /> <appender-ref ref="custom2" /> </logger> </log4net>
here have made 2 appenders give different colours debug
level. @ bottom have made coloredconsoleappenderone
active type com.foo
, coloredconsoleappendertwo
active type com.bar
Comments
Post a Comment