TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Cassie Mod
NA
488
70k
log4net nog logging
Dec 20 2016 7:07 AM
<?
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
>
<?xml version=
"1.0"
encoding=
"utf-8"
?>
<configuration>
<configSections>
<section name=
"log4net"
type=
"log4net.Config.Log4NetConfigurationSectionHandler, log4net"
/>
</configSections>
<log4net>
<appender name=
"RollingFileAppender"
type=
"log4net.Appender.RollingFileAppender"
>
<file value=
"C:\Logs\log.txt"
/>
<appendToFile value=
"true"
/>
<rollingStyle value=
"Size"
/>
<maxSizeRollBackups value=
"10"
/>
<maximumFileSize value=
"250KB"
/>
<staticLogFileName value=
"true"
/>
<layout type=
"log4net.Layout.PatternLayout"
>
<conversionPattern value=
"%date [%thread] %-5level %logger [%property{NDC}] - %message%newline"
/>
</layout>
</appender>
<root>
<level value=
"ALL"
/>
<appender-ref ref=
"RollingFileAppender"
/>
</root>
</log4net>
</configuration>
Hi guys, i'm doing something wrong but I don't know what.
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 ?
Reply
Answers (
3
)
How To Protect My Web Appliacation In a Folder ?
How can I use foreach loop in c# ?