Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • suzyb 463 posts 874 karma points
    Jan 14, 2021 @ 13:17
    suzyb
    0

    Write certain messages custom user log

    I'd like to log messages from a certain controller to a separate file so to not clutter the Umbraco log with information messages.

    The documentation mentions you can write to a custom log file, but can you do this selectively i.e. have umbraco write to it's usual log but a controller write to a different file.

  • Steve Morgan 1274 posts 4191 karma points c-trib
    Jan 14, 2021 @ 14:54
    Steve Morgan
    1

    Hi,

    I don't think so - you could just create your own bespoke logging service and inject this into the controller.

    Something like:

    https://www.infoworld.com/article/2980677/implement-a-simple-logger-in-csharp.html

  • suzyb 463 posts 874 karma points
    Jan 15, 2021 @ 09:42
    suzyb
    0

    OK thanks.

    Might just log them to the Umbraco log if there isn't a built in way to do it. It's just for a one off import so having to create a class is probably more trouble that it's worth.

  • Powell 1 post 71 karma points
    Jan 19, 2021 @ 06:01
    Powell
    0

    Default file output is in the user's home directory. java.util.logging.FileHandler.pattern You can also prevent a Logger from logging messages below a certain level. In this Multiple Appenders can be combined to write log events to multiple destinations. Custom Layouts let you specify how Appenders output log entries.

    MySainsburys

Please Sign in or register to post replies

Write your reply to:

Draft