c# - How to share log4net logger between client and WCF service? -
i'm using log4net in console application log different steps , errors during execution. during processing, application sends data wcf service data used operations.
i client logger setup in console application shared wcf service use in wcf service also. possible ?
the log4net config in client application:
<log4net> <appender name="rollingfileappender" type="log4net.appender.rollingfileappender"> <param name="file" value="logs\\log_" /> <param name="rollingstyle" value="date" /> <param name="datepattern" value="yyyymmdd_hhmmss.\tx\t" /> <param name="staticlogfilename" value="false" /> <maximumfilesize value="100kb" /> <appendtofile value="true" /> <lockingmodel type="log4net.appender.fileappender+minimallock" /> <layout type="log4net.layout.patternlayout"> <conversionpattern value="%date [%thread] %-5level %logger - %message%newline" /> </layout> </appender> <appender name="errorsappender" type="log4net.appender.rollingfileappender"> <param name="file" value="logs\\errorlog_" /> <param name="rollingstyle" value="date" /> <param name="datepattern" value="yyyymmdd_hhmmss.\tx\t" /> <param name="staticlogfilename" value="false" /> <maximumfilesize value="100kb" /> <appendtofile value="true" /> <lockingmodel type="log4net.appender.fileappender+minimallock" /> <layout type="log4net.layout.patternlayout"> <conversionpattern value="%date [%thread] %-5level %logger - %message%newline" /> </layout> <filter type="log4net.filter.levelrangefilter"> <levelmin value="error" /> <levelmax value="fatal" /> </filter> </appender> <root> <level value="all" /> <appender-ref ref="rollingfileappender" /> <appender-ref ref="errorsappender" /> </root> </log4net>
in wcf service:
public class syncservice : isyncservice { public ilog log { get; set; } public void getlogger(ilog _log) { log = _log; } }
interface file:
namespace syncservice { [servicecontract] public interface isyncservice { [operationcontract] void getlogger(ilog _log); } }
and in client application, try pass logger wcf service:
// setup communication wcf service syncservice.syncserviceclient syncclient = new syncservice.syncserviceclient(); // pass logger wcf service syncclient.getlogger(log);
i'm getting error:
cannot serialized aspects: type 'log4net.core.logimpl' in assembly 'log4net [...]
how can pass logger wcf service ?
Comments
Post a Comment