本文整理汇总了C#中ILoggerService.LogWarn方法的典型用法代码示例。如果您正苦于以下问题:C# ILoggerService.LogWarn方法的具体用法?C# ILoggerService.LogWarn怎么用?C# ILoggerService.LogWarn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILoggerService
的用法示例。
在下文中一共展示了ILoggerService.LogWarn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
//.........这里部分代码省略.........
count++;
SerDe.Write(s, buffer.Length);
SerDe.Write(s, buffer);
}
//TODO - complete the impl
logger.LogInfo("Count: " + count);
//if profiler:
// profiler.profile(process)
//else:
// process()
DateTime finish_time = DateTime.UtcNow;
const string format = "MM/dd/yyyy hh:mm:ss.fff tt";
logger.LogInfo(string.Format("bootTime: {0}, initTime: {1}, finish_time: {2}",
bootTime.ToString(format), initTime.ToString(format), finish_time.ToString(format)));
SerDe.Write(s, (int)SpecialLengths.TIMING_DATA);
SerDe.Write(s, ToUnixTime(bootTime));
SerDe.Write(s, ToUnixTime(initTime));
SerDe.Write(s, ToUnixTime(finish_time));
SerDe.Write(s, 0L); //shuffle.MemoryBytesSpilled
SerDe.Write(s, 0L); //shuffle.DiskBytesSpilled
commandProcessWatch.Stop();
// log statistics
inputEnumerator.LogStatistic();
logger.LogInfo(string.Format("func process time: {0}", funcProcessWatch.ElapsedMilliseconds));
logger.LogInfo(string.Format("command process time: {0}", commandProcessWatch.ElapsedMilliseconds));
}
else
{
logger.LogWarn("Nothing to execute :-(");
}
// Mark the beginning of the accumulators section of the output
SerDe.Write(s, (int)SpecialLengths.END_OF_DATA_SECTION);
SerDe.Write(s, Accumulator.accumulatorRegistry.Count);
foreach (var item in Accumulator.accumulatorRegistry)
{
var ms = new MemoryStream();
var value = item.Value.GetType().GetField("value", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(item.Value);
logger.LogInfo(string.Format("({0}, {1})", item.Key, value));
formatter.Serialize(ms, new KeyValuePair<int, dynamic>(item.Key, value));
byte[] buffer = ms.ToArray();
SerDe.Write(s, buffer.Length);
SerDe.Write(s, buffer);
}
int end = SerDe.ReadInt(s);
// check end of stream
if (end == (int)SpecialLengths.END_OF_STREAM)
{
SerDe.Write(s, (int)SpecialLengths.END_OF_STREAM);
logger.LogInfo("END_OF_STREAM: " + (int)SpecialLengths.END_OF_STREAM);
}
else
{
// write a different value to tell JVM to not reuse this worker
SerDe.Write(s, (int)SpecialLengths.END_OF_DATA_SECTION);
Environment.Exit(-1);
}
s.Flush();
// log bytes read and write
logger.LogInfo(string.Format("total read bytes: {0}", SerDe.totalReadNum));
logger.LogInfo(string.Format("total write bytes: {0}", SerDe.totalWriteNum));
// wait for server to complete, otherwise server gets 'connection reset' exception
// Use SerDe.ReadBytes() to detect java side has closed socket properly
// ReadBytes() will block until the socket is closed
SerDe.ReadBytes(s);
}
catch (Exception e)
{
logger.LogError(e.ToString());
try
{
SerDe.Write(s, e.ToString());
}
catch (IOException)
{
// JVM close the socket
}
catch (Exception ex)
{
logger.LogError("CSharpWorker failed with exception:");
logger.LogException(ex);
}
Environment.Exit(-1);
}
}
sock.Close();
}
示例2: Main
//.........这里部分代码省略.........
}
else
{
try
{
var ms = new MemoryStream();
formatter.Serialize(ms, message);
buffer = ms.ToArray();
}
catch (Exception)
{
logger.LogError(string.Format("{0} : {1}", message.GetType().Name, message.GetType().FullName));
throw;
}
}
count++;
SerDe.Write(s, buffer.Length);
SerDe.Write(s, buffer);
}
//TODO - complete the impl
logger.LogInfo("Count: " + count);
//if profiler:
// profiler.profile(process)
//else:
// process()
DateTime finish_time = DateTime.UtcNow;
string format = "MM/dd/yyyy hh:mm:ss.fff tt";
logger.LogInfo(string.Format("bootTime: {0}, initTime: {1}, finish_time: {2}",
bootTime.ToString(format), initTime.ToString(format), finish_time.ToString(format)));
SerDe.Write(s, (int)SpecialLengths.TIMING_DATA);
SerDe.Write(s, ToUnixTime(bootTime));
SerDe.Write(s, ToUnixTime(initTime));
SerDe.Write(s, ToUnixTime(finish_time));
SerDe.Write(s, 0L); //shuffle.MemoryBytesSpilled
SerDe.Write(s, 0L); //shuffle.DiskBytesSpilled
}
else
{
logger.LogWarn("Nothing to execute :-(");
}
// Mark the beginning of the accumulators section of the output
SerDe.Write(s, (int)SpecialLengths.END_OF_DATA_SECTION);
SerDe.Write(s, Accumulator.accumulatorRegistry.Count);
foreach (var item in Accumulator.accumulatorRegistry)
{
var ms = new MemoryStream();
var value = item.Value.GetType().GetField("value", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(item.Value);
logger.LogInfo(string.Format("({0}, {1})", item.Key, value));
formatter.Serialize(ms, new KeyValuePair<int, dynamic>(item.Key, value));
byte[] buffer = ms.ToArray();
SerDe.Write(s, buffer.Length);
SerDe.Write(s, buffer);
}
int end = SerDe.ReadInt(s);
// check end of stream
if (end == (int)SpecialLengths.END_OF_DATA_SECTION || end == (int)SpecialLengths.END_OF_STREAM)
{
SerDe.Write(s, (int)SpecialLengths.END_OF_STREAM);
logger.LogInfo("END_OF_STREAM: " + (int)SpecialLengths.END_OF_STREAM);
}
else
{
// write a different value to tell JVM to not reuse this worker
SerDe.Write(s, (int)SpecialLengths.END_OF_DATA_SECTION);
Environment.Exit(-1);
}
s.Flush();
System.Threading.Thread.Sleep(1000); //TODO - not sure if this is really needed
}
catch (Exception e)
{
logger.LogError(e.ToString());
try
{
SerDe.Write(s, e.ToString());
}
catch (IOException)
{
// JVM close the socket
}
catch (Exception ex)
{
logger.LogError("CSharpWorker failed with exception:");
logger.LogException(ex);
}
Environment.Exit(-1);
}
}
sock.Close();
}