How to log a log4net log when using the Task Scheduler to start a console application?

0

I have compiled a Console application in C # which has log4net (which is already working normally when I run the app) and configured it through the Windows Task Scheduler to run the console application every day X hours.

But when it runs the program, the output of the log is not being done, it just does not log. I would like to know how do I log it even scheduled to run automatically in the Task Scheduler, follow my log4net.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<log4net>

  <root>
    <level value="ALL" />
    <appender-ref ref="console" />
    <appender-ref ref="file" />
  </root>

  <appender name="console" type="log4net.Appender.ConsoleAppender">
    <layout type="log4net.Layout.PatternLayout">
      <!--<conversionPattern value="%date %level %logger - %message%newline" />-->
      <conversionPattern value="%message%newline" />
    </layout>
  </appender>

  <appender name="file" type="log4net.Appender.RollingFileAppender">
    <file value="logs/migracaoLog.txt" />
    <appendToFile value="false" />
    <rollingStyle value="Size" />
    <maxSizeRollBackups value="5" />
    <maximumFileSize value="10MB" />
    <staticLogFileName value="true" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date [%thread] %level %logger - %message%newline" />
    </layout>
  </appender>  
</log4net>

</configuration>
    
asked by anonymous 19.09.2018 / 19:56

0 answers