.net - log4net - separate appender for a namespace -
i have been googling haven't yet found answer question. have application , have client library connecting me database (in case, it's ravendb).
i ravendb client messages go separate file (meaning, messages instances of classes of raven.client.xyz should logged raven-client.log file - actions client library performs, e.g. connecting server, waiting response, getting/updating documents, querying index, etc., not code interacting client library). how can achieve that? tried separate appender, ravendb logs appear in application logger too.
i'm using xml configuration , log4net version 1.2.10
actually, checked , solution works:
<log4net> <appender name="consoleappender" type="log4net.appender.consoleappender"> <layout type="log4net.layout.patternlayout"> <conversionpattern value="%utcdate [%thread] %-3level %logger - %message%newline" /> </layout> </appender> <appender name="fileappender" type="log4net.appender.rollingfileappender"> <file value="application.log" /> <lockingmodel type="log4net.appender.fileappender+minimallock" /> <appendtofile value="true" /> <rollingstyle value="composite" /> <datepattern value="yyyymmdd" /> <maxsizerollbackups value="10" /> <maximumfilesize value="1mb" /> <layout type="log4net.layout.patternlayout"> <conversionpattern value="%utcdate [%thread] %-3level %logger - %message%newline" /> </layout> </appender> <appender name="ravenclientfileappender" type="log4net.appender.rollingfileappender"> <file value="ravendb-client.log" /> <lockingmodel type="log4net.appender.fileappender+minimallock" /> <appendtofile value="true" /> <rollingstyle value="composite" /> <datepattern value="yyyymmdd" /> <maxsizerollbackups value="10" /> <maximumfilesize value="1mb" /> <layout type="log4net.layout.patternlayout"> <conversionpattern value="%utcdate [%thread] %-3level %logger - %message%newline" /> </layout> </appender> <logger name="raven.client" additivity="false"> <level value="debug" /> <appender-ref ref="ravenclientfileappender" /> </logger> <root> <level value="debug" /> <appender-ref ref="consoleappender" /> <appender-ref ref="fileappender" /> </root> </log4net>
sorry everyone, was on right track this
Comments
Post a Comment