|
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;
using System.EnterpriseServices;
using log4net;
using log4net.Config;
[assembly: ApplicationName("JayTest")]
[assembly: Description("Jay Test business layer com+")]
[assembly: ApplicationActivation(ActivationOption.Server)]
[assembly: ApplicationAccessControl(false, AccessChecksLevel = AccessChecksLevelOption.ApplicationComponent)]
namespace busLayer
{
[GuidAttribute("ADF0D549-D84B-422c-A15E-5B22C1E35FB5")]
public class JayClass :ServicedComponent
{
private static readonly ILog log = LogManager.GetLogger("ErrorLogger");
public JayClass()
{
FileInfo fi = new FileInfo(@"C:\Temp\Logging\busLayer\app.config");
log4net.Config.XmlConfigurator.ConfigureAndWatch(fi);
}
public string MyLog(string message)
{
if (log.IsDebugEnabled)
log.Debug(message);
if (log.IsWarnEnabled)
log.Warn("warn " + message);
if (log.IsErrorEnabled)
log.Error("error " + message);
return message;
}
public string MyLogi(string message, int i, DateTime d, decimal dec)
{
for (int j = 0; j < i; j++)
{
if (log.IsDebugEnabled)
log.Debug("debug " + message);
if (log.IsWarnEnabled)
log.Warn("warn " + message);
if (log.IsErrorEnabled)
log.Error("error " + message);
}
return message + i.ToString();
}
public string MyLogs(string message, string i)
{
if (log.IsDebugEnabled)
log.Debug(message);
if (log.IsWarnEnabled)
log.Warn("warn " + message);
if (log.IsErrorEnabled)
log.Error("error " + message);
return message + i;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am a software architect/developer, having 15 years of design/development experience. Currently working in large financial corporation, architecting .NET applications and coding using C#, ASP.NET, Java Script etc..
MS Computers, MCP, MCTS: .NET Framework 2.0 Web Applications.