English 中文(简体)
如何使用日志4net 在应用程序中读取和显示我的日志文件信息
原标题:How to read and display my log file info in application using Log4net
  • 时间:2012-05-25 11:59:59
  •  标签:
  • c#
  • log4net

我在申请时使用Log4net。

谁能解释一下如何阅读我的日志文件( Txt) 并在我的应用程序中显示它。 因为我的日志文件在另一个服务器中 。

What will be the config settings to read the log files from the server and show it in the C# application. This is the code have used to write the logs.

    <log4net>
  <appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
  <file value="\10.8.8.87	emplogs.log" />
  <appendToFile value="true" />
  <maximumFileSize value="10MB" />
  <maxSizeRollBackups value="50" />
  <rollingStyle value="Size" />
  <layout type="log4net.Layout.PatternLayout">
     <conversionPattern value="%identity---- %date [%thread] %-5level %logger - %message%newline" />
  </layout>
</appender>
<root>
  <level value="DEBUG" />
  <appender-ref ref="RollingFile" />
</root>
</log4net>
问题回答

而不是滚动文件附加件, 您可以更好地使用 sql 附加件来记录您在数据库和应用程序上的例外, 您可以查询数据库。 您可以在此页面找到一些配置示例 :

http://tlogy.apache.org/log4net/release/config-examples.html" rel=“nofollow'>http://tlogy.apache.org/log4net/release/config-examples.html





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签