NFireLogger is .net server-side library for FireLogger.

It's available as NuGet package:

Sorry, FireLogger works only under Firefox.

Examples

Some examples

Basic usage

Easiest way is to use static class FLog. There are 5 log levels.

FLog.Debug("DEBUG log level");
FLog.Info("INFO log level");
FLog.Error("ERROR log level");
FLog.Warning("WARNING level");
FLog.Critical("CRITICAL log level");

Each has formatted version:

FLog.Info("Request from {0} arrived at {1}", Request.UserHostAddress, DateTime.Now);

Named Logger

var logger = FLog.GetLogger("MyLogger");

logger.Debug("This is logged as MyLogger");
logger.Warning("... and also this.");

Exception

There is method for exception logging.

try
{
    DoSomething();
}
catch (Exception ex)
{
    FLog.Exception(ex);
}

Log4net Support

There is FireLogger appender for log4net.

It's available also as NuGet package:

Configuration

You have to add appender NFireLogger.Log4net.FireLoggerAppender to your log4net configuration. E.g.:

<appender name="FireLogger" type="NFireLogger.Log4net.FireLoggerAppender, NFireLogger.Log4net">
    <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value=%message" />
    </layout>
</appender>

Example

After that you can use log4net as usual

var l = LogManager.GetLogger("log4net");

l.Info("Info message from log4net");
l.DebugFormat("and debug message at {0}", DateTime.Now.ToShortTimeString());

Configuration

There are 2 configurations that can be put in appSettings section in web.config:

NFireLogger.Password
Specify password for FireLogger authentication. Default: ""
NFireLogger.Silent
All internal errors of FireLogger are thrown away if this is set to true. Otherwise it's logged by standard Trace technique. Default: true
NFireLogger.LogFileInfo
In every log there will be file name and line number information it this is set to true. Default: true
<configuration>
    <appSettings>
        <add key="NFireLogger.Password" value="password" />
        <add key="NFireLogger.Silent" value="true" />
        <add key="NFireLogger.LogFileInfo" value="true" />
    </appSettings>
</configuration>

Manual Setup

If you don’t want to use NuGet, here is manual setup:

1 Add reference for NFireLogger.dll to your project.

2 Add HttpModul NFireLogger.FireLoggerHttpModule to your web.config.

For IIS7 in Integrated mode it looks like this:

<system.webServer>
    <modules>
        <add name="FireLoggerHttpModule" type="NFireLogger.FireLoggerHttpModule"/>
    </modules>
</system.webServer>

For Standard mode or IIS6 look at documentation for server.

3 Done! Now you can use FLog.

Fork me on GitHub