我在远程计算机上实时调试Windows服务时遇到问题.该机器位于防火墙后面,只能通过远程桌面访问.我通过我的代码包含Debug.WriteLine语句,而不是Console.WriteLine.不久前,我遇到了一个名为Debug View的 Microsoft应用程序.它在调试Forms和WPF应用程序时很有用,但它不会显示正在运行的服务的Debug.WriteLine语句.如果我能看到这些调试语句,我会非常高兴.有没有办法做到这一点?
注意,项目是在调试模式下编译的,因为我可以在服务安装期间看到Debug View中的调试语句.
由于这里的用户,我最近来到了log4net.无论如何,我想将每个Console.Write()和Debug.Write()自动记录到我配置的单个日志文件中.另外,我使用了许多类库,这些类也有对log4net一无所知的Console/Debug语句.这些也可以根据配置自动记录到日志文件中吗?这有可能吗?
我想要记录滚动日志文件:
Console.WriteLine("console statement");
Debug.WriteLine("debug statement");
Run Code Online (Sandbox Code Playgroud)
实例化记录器:
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static void InitializeLogger()
{
XmlConfigurator.Configure();
}
Run Code Online (Sandbox Code Playgroud)
整个app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="SubToolsPortServerTest.log"/>
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="2" />
<maximumFileSize value="1MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %c %m%n"/>
</layout>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="LogFileAppender" />
</root>
</log4net>
</configuration>
Run Code Online (Sandbox Code Playgroud) 我想在Android应用程序中为一个mp3写歌词.我找到了一个java库,用于读取mp3文件和读取/操作ID3标签(ID3v1和ID3v2.2到ID3v2.4),名为mp3agic.
我修改mp3agic了编写ID3v2标签的歌词标签,写下标签:USLT.在维基百科中找到
在Android应用程序示例中,我修改了MP3的艺术家,专辑,标题,流派,歌词和评论.除歌词外,所有标签都被正确修改.PowerAMP用于验证修改后的MP3文件,PowerAMP无法在MP3中找到歌词.
如果有人熟悉这个库,这里是我从AbstractID3v2Tag.java修改的代码:
//define lyric tag for id3v2
public static final String ID_TEXT_LYRICS = "USLT";
//get the lyrics from the tag
public String getLyrics() {
ID3v2TextFrameData frameData;
if (obseleteFormat) return null;
else frameData = extractTextFrameData(ID_TEXT_LYRICS);
if (frameData != null && frameData.getText() != null)
return frameData.getText().toString();
return null;
}
//set the lyrics in the tag
public void setLyrics(String lyrics) {
if (lyrics != null …Run Code Online (Sandbox Code Playgroud)