Giter Club home page Giter Club logo

mojito.simplelogging's People

Contributors

wjinlei avatar

Watchers

 avatar

mojito.simplelogging's Issues

在1秒内可能出现需要多次滚动的情况

例如,假如你的`maxRollSize="200b"

当你在程序中多次写日志,例如

[Test]
public void TestLogHelper()
{
    LogHelper.Debug("Test Message");
    LogHelper.Info("Test Message");
    LogHelper.Warn("Test Message");
    LogHelper.Error("Test Message"); // 假如执行到这里,日志文件的大小超过200个字节了,进行了日志滚动,并创建了新的日志
    LogHelper.Fatal("Test Message");
    LogHelper.Info("Test Message");
    LogHelper.Warn("Test Message");
    LogHelper.Error("Test Message"); // 当执行到这里的时候,新的日志文件的大小又超过200字节了,又需要日志滚动,但这这些操作都在1秒内被执行
    LogHelper.Fatal("Test Message");
}

此时,滚动的文件名,和之前的文件名一样(秒数一致),因此会移动失败,日志文件中会有记录如下:

2023-11-18 16:34:14 [Error] Test Message
2023-11-18 16:34:14 [Fatal] Test Message
2023-11-18 16:34:14 [Info] Test Message
2023-11-18 16:34:14 [Warn] Test Message
2023-11-18 16:34:14 [Error] Test Message
2023-11-18_16-34-14 RollError 当文件已存在时,无法创建该文件。    at System.IO.FileSystem.MoveFile(String sourceFullPath, String destFullPath, Boolean overwrite)
   at Mojito.SimpleLogging.Loggers.FileLogger.RollBackups() in D:\Codes\Mojito.SimpleLogging\Mojito.SimpleLogging\Loggers\FileLogger.cs:line 61
2023-11-18 16:34:14 [Fatal] Test Message

这个问题没什么影响,无法移动,他会把日志继续写入到当前日志文件中,所以可以忽略。

不过我想看能不能有什么优化的方式。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.