本文整理汇总了C#中log4net.ILog类的典型用法代码示例。如果您正苦于以下问题:C# log4net.ILog类的具体用法?C# log4net.ILog怎么用?C# log4net.ILog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
log4net.ILog类属于命名空间,在下文中一共展示了log4net.ILog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Log4NetProxy
public Log4NetProxy(log4net.ILog logger)
{
if (logger == null)
throw new ArgumentNullException("logger");
_logger = logger;
}
示例2: Log4netLogger
public Log4netLogger(Type type)
{
//_innerLogger = log4net.LogManager.GetLogger(type);
log4net.ILog[] loggers = log4net.LogManager.GetCurrentLoggers();
_innerLogger = log4net.LogManager.GetLogger("Logging");
log4net.Config.DOMConfigurator.Configure();
}
示例3: Log4NetLog
public Log4NetLog(ILog4NetLog log)
{
if (log == null)
throw new ArgumentNullException("log");
this.log = log;
}
示例4: GoogleMapsEngineAPI
/*
* Constructor for Google Maps API utilities
*/
public GoogleMapsEngineAPI(ref log4net.ILog log)
{
// establish the Google APIs project key
this.GOOGLE_API_KEY = Properties.Settings.Default.gme_api_key;
// establish the Google Maps Engine API settings
this.GME_API_PROTOCOL = Properties.Settings.Default.gme_api_protocol;
this.GME_API_DOMAIN = Properties.Settings.Default.gme_api_domain;
this.GME_API_SERVICE = Properties.Settings.Default.gme_api_service;
this.GME_API_VERSION = Properties.Settings.Default.gme_api_version;
// set the log
this.log = log;
// retrieve a reference to the extension
log.Debug("Retrieiving a reference to the extension object.");
ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension();
// create a Google Maps Engine Session Id for this set of sessions
GoogleMapsEngineAPISessionId = Guid.NewGuid();
// if debug, create a debug folder to keep track of information
if (log.IsDebugEnabled)
{
// create a temporary folder
debugDirectory = System.IO.Directory.CreateDirectory(
ext.getLocalWorkspaceDirectory()
+ "\\GME_API_TMP_"
+ GoogleMapsEngineAPISessionId.ToString().Replace("-",""));
}
}
示例5: Log4NetLog
/// <summary>
/// Initializes a new instance of the <see cref="Log4NetLog"/> class.
/// </summary>
/// <param name="log">The log.</param>
public Log4NetLog(log4net.ILog log)
{
if (log == null)
throw new ArgumentNullException("log");
m_Log = log;
}
示例6: Subtitles
public Subtitles(log4net.ILog log = null)
{
Log = log;
items = new List<SubtitleItem>();
rwLock = new ReaderWriterLockSlim();
SubtitleLocations = new List<string>();
track = -1;
}
示例7: Main
static void Main(string[] args)
{
log4net.Config.XmlConfigurator.Configure();
Log = log4net.LogManager.GetLogger(typeof(Program));
Root = ConfigurationManager.AppSettings["serviceRoot"];
Apploader = ConfigurationManager.AppSettings["apploader"];
Apps = new Dictionary<string, Process>();
Log.Info("==== AppServer && Apploader ====");
Log.InfoFormat("从目录{0}下开始启动各应用", Root);
//TODO:支持指定pid,可通过读取对应目录下的xxxconfig来完成
Directory.GetDirectories(Root)
.Where(o => Filter(o)).ToList().ForEach(o => Start(o));
//激活AppAgent
Log.Info("启用AppAgent");
new DefaultAgent(new Log4NetLogger(Log)
, ConfigurationManager.AppSettings["appAgent_master"]
, ConfigurationManager.AppSettings["appAgent_name"]
, ConfigurationManager.AppSettings["appAgent_description"]
, new CommandHandle())
.Run();
Log.Info("==== 启动完成 ====\n\n");
RenderOutput();
System.Console.ReadKey();
}
示例8: BatchJob
public BatchJob()
{
InitializeComponent();
log4net.Config.XmlConfigurator.Configure();
log = log4net.LogManager.GetLogger("Log.BatchJob");
this.ServiceName = "BatchJob";
}
示例9: WriteLog
public void WriteLog(LogEnum name, LogLevel level, string logContent)
{
log = log4net.LogManager.GetLogger(name.ToString());
//log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
switch (level)
{
case LogLevel.DEBUG:
log.Debug(logContent);
break;
case LogLevel.ERROR:
log.Error(logContent);
break;
case LogLevel.FATAL:
log.Fatal(logContent);
break;
case LogLevel.INFO:
log.Info(logContent);
break;
case LogLevel.WARN:
log.Warn(logContent);
break;
default:
log.Debug(logContent);
break;
}
}
示例10: CLI
public CLI(IDirectoryLocator directoryLocator, PluginLoader pluginLoader, IController controller)
{
_logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
_directoryLocator = directoryLocator;
_pluginLoader = pluginLoader;
_controller = controller;
}
示例11: OnStart
protected override void OnStart(string[] args)
{
string baseDir = AppDomain.CurrentDomain.BaseDirectory;
log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(baseDir + "log4net.xml"));
log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
try
{
// Pick one
//RemotingConfiguration.CustomErrorsEnabled(false);
RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
//RemotingConfiguration.Configure(baseDir + "RrdbFileService.exe.config");
log.Info("RrdDb file server started");
var nameValueCollection = (NameValueCollection)ConfigurationManager.GetSection("rrdbfileserver");
log.InfoFormat("Database file base path:{0}", nameValueCollection["databasepath"]);
string port = nameValueCollection["port"];
int portNumber = int.Parse(port);
channel = new TcpChannel(portNumber);
ChannelServices.RegisterChannel(channel, false);
log.InfoFormat("Server object registerd on port {0}", portNumber);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(RrdDbAdapter),
"GetRrdDbAdapter",
WellKnownObjectMode.Singleton);
log.Info("Service up and running");
}
catch (Exception ex)
{
log.Error(ex);
throw;
}
}
示例12: OnException
protected override void OnException(ExceptionContext filterContext)
{
//Log error
logger = log4net.LogManager.GetLogger(filterContext.Controller.ToString());
logger.Error(filterContext.Exception.Message, filterContext.Exception);
}
示例13: Log4NetImp
public Log4NetImp(string log4ConfigFileFullPath,string log4ConfigLoggerName)
{
_log4ConfigFileFullPath = log4ConfigFileFullPath;
_log4ConfigLoggerName = log4ConfigLoggerName;
//Log4Net--初始化
if (!File.Exists(_log4ConfigFileFullPath))
{
throw new Exception(string.Format(
"Log4Net配置信息文件没有找到!检查配置节点{{ConfigInfo_NewMyCat:Log4NetConfigFileName}}是否正确。{0}FilePath:{1}",
System.Environment.NewLine, _log4ConfigFileFullPath));
}
//
var logCfg = new FileInfo(this._log4ConfigFileFullPath);
XmlConfigurator.ConfigureAndWatch(logCfg);
//
if (string.IsNullOrWhiteSpace(log4ConfigLoggerName))
{
throw new Exception(string.Format("在项目配置文件中检查配置节点{{ConfigInfo_NewMyCat:Log4ConfigLoggerName}}不能为空。"));
}
//
var repository = log4net.LogManager.GetRepository();
if (repository.GetLogger(_log4ConfigLoggerName) == null)
{
throw new Exception(string.Format("在log4net日志配置文件({0})中检查配置节点<logger name=\"{1}\" additivity=\"false\">不存在。", log4ConfigFileFullPath,log4ConfigLoggerName));
}
_logger = log4net.LogManager.GetLogger(_log4ConfigLoggerName);
}
示例14: Main
static void Main(string[] args)
{
if (string.IsNullOrEmpty(Thread.CurrentThread.Name))
Thread.CurrentThread.Name = "Main";
#if WINDOWS && DEBUG
if (!System.Diagnostics.Debugger.IsAttached)
{
AllocConsole();
var stdHandle = GetStdHandle(STD_OUTPUT_HANDLE);
var safeFileHandle = new SafeFileHandle(stdHandle, true);
var fileStream = new FileStream(safeFileHandle, FileAccess.Write);
var encoding = Encoding.GetEncoding(CODE_PAGE);
var stdOut = new StreamWriter(fileStream, encoding) { AutoFlush = true };
Console.SetOut(stdOut);
}
#endif
_log = LogManager.GetLogger(typeof(Program));
_log.Info("### !!! APPLICATION LOAD !!! ###");
_log.Info("Deleting old log files (>7 days)...");
// Delete log files older than 7 days
if (Directory.Exists("logs"))
{
var now = DateTime.Now;
var max = new TimeSpan(7, 0, 0, 0); // 7 days
foreach (var file in from file in Directory.GetFiles("logs")
let modTime = File.GetLastAccessTime(file)
let age = now.Subtract(modTime)
where age > max
select file)
{
try
{
File.Delete(file);
_log.Info("Deleted old log file: " + file);
}
catch (IOException ex)
{
_log.Warn("Failed to delete log file: " + file + "(" + ex.Message + ")");
}
}
}
_log.Info("Old log files deleted!");
_log.Info("Starting game...");
using (var game = new MainGame())
game.Run();
#if WINDOWS && DEBUG
_log.Debug("Unloading console...");
FreeConsole();
_log.Debug("Console unloaded!");
#endif
_log.Info("### !!! APPLICATION EXIT !!! ###");
}
示例15: AudioManager
public AudioManager(bool hardware = true)
{
_log = Logging.LogManager.GetLogger(this);
_log.Info("Initializing AudioManager...");
_log.Info("Creating FMOD system...");
uint version = 0;
RESULT result = Factory.System_Create(ref _system);
ErrCheck(result);
_log.Debug("Checking FMOD version...");
result = _system.getVersion(ref version);
ErrCheck(result);
if (version < VERSION.number)
{
var msg = string.Format("Error! You are using an old version of FMOD: {0}. This program requires: {1}.",
version.ToString("X"), VERSION.number.ToString("X"));
_log.Fatal(msg);
throw new FMODException(msg);
}
result = _system.init(MaxChannels, INITFLAGS.NORMAL, (IntPtr) null);
ErrCheck(result);
_soundManager = new SoundManager(_system, hardware);
_songManager = new SongManager(_system, hardware);
_log.Info("AudioManager initialized!");
}