- "1.0" encoding="utf-8" ?>
- xml version="1.0" encoding="utf-8" ?>
- <configuration>
- <configSections>
- configSections>
- <appSettings>
- <add key="log4net.Config" value="log4net.config"/>
- <add key="log4net.Config.Watch" value="True"/>
- <add key="log4net.Internal.Debug" value="False"/>
- appSettings>
- <connectionStrings>
- <add name="WindowsFormsApplication1.Properties.Settings.CLAConnectionsConnectionString"
- connectionString="Data Source=MAC-CASPER\SQLSERVERCASPER;Initial Catalog=CLAConnections;User ID=Defcon;Password=0000"
- providerName="System.Data.SqlClient" />
- connectionStrings>
- configuration>
-
-
"log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> -
-
"RollingFileAppender" type="log4net.Appender.RollingFileAppender"> -
"C:\Logs\log.txt" /> -
"true" /> -
"Size" /> -
"10" /> -
"250KB" /> -
"true" /> -
"log4net.Layout.PatternLayout" > -
"%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" /> -
-
"ALL" /> -
"RollingFileAppender" />
I use log4 net for logging.
I made a class called Logger:
- using System;
- using log4net;
- namespace WindowsFormsApplication1.Core
- {
- public class Logger
- {
- private static ILog Log { get; set; }
- static Logger()
- {
- Log = LogManager.GetLogger(typeof(Logger));
- }
- public static void Error(object msg)
- {
- Log.Error(msg);
- }
- public static void Error(object msg, Exception ex)
- {
- Log.Error(msg, ex);
- }
- public static void Error(Exception ex)
- {
- Log.Error(ex.Message, ex);
- }
- public static void Info(object msg)
- {
- Log.Info(msg);
- }
- }
- }
And I can call it true logger.Error(ex);
However it is not logging anything ?? so what am I doing wrong ?
3 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Cassie ModPosted Dec 20, 2016, 7:29 AM
Cassie ModPosted Dec 20, 2016, 7:28 AM
Mangesh GPosted Dec 20, 2016, 7:13 AM