本文整理汇总了C#中log4net.ILog.Info方法的典型用法代码示例。如果您正苦于以下问题:C# log4net.ILog.Info方法的具体用法?C# log4net.ILog.Info怎么用?C# log4net.ILog.Info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类log4net.ILog
的用法示例。
在下文中一共展示了log4net.ILog.Info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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 !!! ###");
}
示例2: 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();
}
示例3: 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!");
}
示例4: 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;
}
}
示例5: TextManager
public TextManager(Map map)
{
_log = Logging.LogManager.GetLogger(this);
_log.Info("TextManager is loading map text entries...");
_texts = new List<Text>();
_activeText = null;
if (!map.HasLayer("text"))
{
_log.Info("No text layer detected on map, aborting...");
return;
}
foreach (var obj in map.FindObjects((l, o) => l.Name == "text"))
{
string title = obj.Properties.ContainsKey("title") ? obj.Properties["title"] : "<No Title>";
string subtitle = obj.Properties.ContainsKey("subtitle") ? obj.Properties["subtitle"] : null;
_log.DebugFormat("Adding new text {0} of type {1}", obj.Name, obj.Type);
_texts.Add(new Text(obj.Bounds, obj.Name, obj.Type, title, subtitle));
}
_log.Debug("TextManager initialized!");
}
示例6: 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;
}
}
示例7: DriverManager
protected DriverManager()
{
_loadedDrivers = new Dictionary<string, IDriver>();
_driverDefinition = new Dictionary<string, KaiTrade.Interfaces.IDriverDef>();
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(MyResolveEventHandler);
_wireLog = log4net.LogManager.GetLogger("KaiTradeWireLog");
_wireLog.Info("DriverManager Created");
}
示例8: SteamFriendList
/// <summary>
/// Initialize a new <c>SteamFriendList</c>.
/// </summary>
internal SteamFriendList()
{
_log = LogManager.GetLogger(this);
_list = new List<SteamFriend>();
_updateTimer = new Timer(Update, null, 0, 60000);
SteamManager.OnSteamClose += SteamClose;
_log.Info("SteamFriendList loaded!");
}
示例9: SoundManager
internal SoundManager(FMOD.System system, bool hardware = true)
{
_log = Logging.LogManager.GetLogger(this);
_log.Info("Initializing SoundManager...");
_system = system;
_sounds = new List<Sound>();
_soundMode = hardware ? MODE.HARDWARE : MODE.SOFTWARE;
_log.DebugFormat("Sound Mode == {0}", _soundMode);
_log.Debug("SoundManager initialized!");
}
示例10: ProductManager
protected ProductManager()
{
//m_Products = new Dictionary<string, KaiTrade.Interfaces.IProduct>();
//m_MnemonicProduct = new Dictionary<string, KaiTrade.Interfaces.IProduct>();
m_Products = new System.Collections.Hashtable();
m_MnemonicProduct = new System.Collections.Hashtable();
m_Name = "KTAProductManager";
m_Log = log4net.LogManager.GetLogger("Kaitrade");
m_Log.Info("ProductManager Created");
}
示例11: PacketListener
public PacketListener(Protocol protocol)
{
_log = LogManager.GetLogger(this);
_log.Debug("Setting protocol...");
_protocol = protocol;
_log.Debug("Creating packet listen thread...");
_listenThread = new Thread(ReadPackets) {Name = "PacketListen", IsBackground = true};
_log.Debug("Starting packet listen thread...");
_running = true;
_listenThread.Start();
_log.Info("Packet listen thread started!");
}
示例12: SongManager
internal SongManager(FMOD.System system, bool hardware = true)
{
_log = Logging.LogManager.GetLogger(this);
_log.Info("Initializing SongManager...");
_system = system;
_songs = new List<Song>();
// ReSharper disable BitwiseOperatorOnEnumWihtoutFlags
if (hardware)
_soundMode = MODE._2D | MODE.HARDWARE | MODE.CREATESTREAM;
else
_soundMode = MODE._2D | MODE.SOFTWARE | MODE.CREATESTREAM;
// ReSharper restore BitwiseOperatorOnEnumWihtoutFlags
_log.DebugFormat("Sound Mode == {0}", _soundMode);
_log.Debug("SongManager initialized!");
}
示例13: ControlsManager
internal ControlsManager(string file)
{
_log = LogManager.GetLogger(this);
if (File.Exists(file))
{
_log.Info("Loading controls from " + file + "...");
Controls = Serializer.JsonDeserialize<Controls>(file);
_log.Debug("Controls loaded!");
}
else
{
Controls = new Controls();
SetDefaultControls();
_log.Debug("Saving controls to " + SettingsFile + "...");
Serializer.JsonSerialize(Controls, SettingsFile);
}
CheckControls();
}
示例14: SteamGUI
/// <summary>
/// Initializes a new Steam GUI.
/// </summary>
public SteamGUI()
{
InitializeComponent();
_log = LogManager.GetLogger(this);
_log.Info("SteamGUI is initializing...");
_steamClosed = false;
sendButton.Enabled = false;
nameLabel.Text = SteamManager.GetName();
statusLabel.Text = SteamManager.GetStatus(true);
friendsLabel.Text = string.Format(FriendFormat, SteamManager.FriendList.GetFriendCount(true),
SteamManager.FriendList.GetFriendCount());
foreach (var friend in SteamManager.FriendList.GetFriends())
{
var item = new ListViewItem(new[] { friend.GetName(), friend.GetStatus(true) }) { Tag = friend.SteamID };
friendList.Items.Add(item);
}
SteamManager.FriendList.OnFriendsUpdate += UpdateData;
_log.Debug("SteamGUI is registering to OnSteamClose event...");
SteamManager.OnSteamClose += SteamClose;
_log.Debug("SteamGUI is registering to OnMinecraftData event...");
SteamManager.OnMinecraftData += UpdateMinecraftdata;
_log.Info("SteamGUI loaded!");
}
示例15: Client
/// <summary>
/// Initialize a new Minecraft client.
/// </summary>
/// <param name="server">The server to connect to.</param>
/// <param name="player">The player who logged in with the client.</param>
public Client(Server server, Player player)
{
_log = LogManager.GetLogger(this);
_log.Debug("Minecraft Client created!");
_server = server;
_log.Debug("Loading Items from file...");
try
{
using (var reader = new StreamReader(Constants.MinecraftItemFile))
Items = new JsonSerializer().Deserialize<List<Item>>(new JsonTextReader(reader));
}
catch(IOException ex)
{
_log.Error("Failed to read item list from file!");
_log.Error(ex.GetType() + ": " + ex.Message);
_log.Error("Stack Trace:\n" + ex.StackTrace);
throw new Exception("Sharpcraft.Library.Minecraft.Client failed to initialize! Could not read item list file!", ex);
}
_log.Debug("Creating communication protocol...");
_protocol = new Protocol(_server.Address, _server.Port);
_log.Info("Client initiated on " + _server.Address + ":" + _server.Port + "!");
_player = player;
_world = new World();
}