Skip to content

skahal/Skahal.Infrastructure.Logging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Skahal.Infrastructure.Logging

Skahal.Infrastructure.Framework.Logging.ILogStrategy's implementations.


Features

  • Log4net (Log4netLogStrategy)
  • Mono support
  • Fully tested on Windows and MacOSX
  • Tests coveraged
  • Good (and well used) design patterns

Setup

PM> Install-Package Skahal.Infrastructure.Logging.Log4net

Using Log4netLogStrategy

Add log4net configuration to app.config/web.config. A basic configuration looks like:

<configuration>
  <configSections>
     <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
 <log4net>
    <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
      <file value="Logs/log.txt" />
      <appendToFile value="true" />
      <rollingStyle value="Size" />
      <maxSizeRollBackups value="10" />
      <maximumFileSize value="100KB" />
      <staticLogFileName value="true" />
      <ImmediateFlush value="true" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%d{dd/MM/yy HH:mm:ss} [%level%] %m%newline" />
      </layout>
    </appender>
    <root>
      <level value="ALL" />
      <appender-ref ref="RollingFileAppender" />
    </root>
  </log4net>

In your app initialization, like global.asax, add:

protected void Application_Start()
{
    LogService.Debug("Application starting...");
    LogService.Debug("Machine: {0}", Environment.MachineName);
    LogService.Initialize(new Log4netLogStrategy("App"));

    LogService.Debug("Registering something...");
    // your app initilization code.
}

Roadmap

  • Unity3d degug log: Unity3dLogStrategy

How to improve it?

Create a fork of Skahal.Infrastructure.Logging.

Did you change it? Submit a pull request.

License

Licensed under the The MIT License (MIT). In others words, you can use this library for developement any kind of software: open source, commercial, proprietary and alien.

Change Log

  • 1.0.1 HelperSharp updated.
  • 0.5.0 First version.

About

Skahal.Infrastructure.Framework.Logging.ILogStrategy's implementations.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages