C# 如何在此会话日志中进行编码
我已经编写了自己的日志文件,但我使用的工具要求对其进行编码 “Session.SessionLogPath”-下面是我写入日志文件的地方 我现在确定了如何在下面包含“Session.SessionLogPath”C# 如何在此会话日志中进行编码,c#,.net,C#,.net,我已经编写了自己的日志文件,但我使用的工具要求对其进行编码 “Session.SessionLogPath”-下面是我写入日志文件的地方 我现在确定了如何在下面包含“Session.SessionLogPath” string LogPath = AppDomain.CurrentDomain.BaseDirectory; string filename = "\\Log.txt"; string filepath = LogPath + fil
string LogPath = AppDomain.CurrentDomain.BaseDirectory;
string filename = "\\Log.txt";
string filepath = LogPath + filename;
if (!File.Exists(filepath))
{
StreamWriter writer = File.CreateText(filepath);
writer.Close();
}
using (StreamWriter writer = new StreamWriter(filepath, true))
{
writer.WriteLine(Message);
如果您使用的是WinSCP.NET,则可以创建会话类的实例,并访问属性SessionLogPath
Session session = new Session();
session.SessionLogPath = "D:/pathForYourLogFile"
下面是一个更彻底的什么是“我曾试图在代码的各个部分包含这一点,但它没有被接受。”是什么意思?更具体一点。
SessionLogPath
看起来像一个字符串,应该指向存储日志文件的磁盘中的方向。我更改了post以显示当前日志文件的写入。是否使用WinSCP?