Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plug in a real logger. #5

Closed
Jetski5822 opened this issue Jan 25, 2015 · 11 comments
Closed

Plug in a real logger. #5

Jetski5822 opened this issue Jan 25, 2015 · 11 comments
Assignees

Comments

@Jetski5822
Copy link
Member

At the moment we have just a static console logger called FakeLogger. Lets get a real one in there and allow it to be easily swap-able.

@Jetski5822 Jetski5822 added this to the Logging milestone Apr 20, 2015
@Jetski5822 Jetski5822 self-assigned this Apr 20, 2015
@hishamco
Copy link
Member

I'm planning to create FileLoggerProvider that we can subclasses and allow us to create a variety of file logger such as TextLoggerProvider, XmlLoggerProvider .. etc

So can can I make a PR , or shall I write a sample code to show you my humble design?

@hishamco
Copy link
Member

/cc @Jetski5822

@Jetski5822
Copy link
Member Author

Argh, my comment didn't save.

I think its a good idea to give it a go, have you seen the https://GitHub.com/aspnet/logging work?

I'll comment more tomorrow as on phone at mo.

@hishamco
Copy link
Member

Of course and I did a humble PRs, so shall I make a PR or write a code snippet first

@Jetski5822
Copy link
Member Author

Lets take a look at a code snippet :)

@hishamco
Copy link
Member

Sure 😄

@hishamco
Copy link
Member

aspnet/Logging#201

@Jetski5822
Copy link
Member Author

So, create a LoggingModule : IModule, add add a Logger based on configuration. Then if we want to log to a file, its just configuration.

Make the default NLog? Or console?

Whatcha think?

@hishamco
Copy link
Member

Of course the configuration is very handy in almost the providers: logging, authentication .. etc. The ConsoleLogger is good as default logging provider, also we may need sort of CompositeProvider to log into different sources at one shoot, let me take the initiative 😄 , I planned to do that from few weeks ago but I stuck every time on launching the url, I appreciate your effort to make the fix, it is time to move into this 👍

@hishamco
Copy link
Member

@Jetski5822 I faced some issues:
1- I got MissingMethodException in GetRefrencingLibraries whenever i'm trying to run unit test
2- Is there a default configuration file that we can put the logger settings
3- If I create a LoggingModule that implement IModule, is the DI of IServiceCollection done out of the box, or shall I do some extra stuff

@Jetski5822
Copy link
Member Author

Okay done! To plug in another logger we just need to create a module and implement the ILoggingInitiator interface. This will then get added to the Logger pipeline at the ApplicationServices level.

i.e.

public class LoggingInitiator : ILoggingInitiator {
    public void Initialize(ILoggerFactory loggerFactory) {
        loggerFactory.AddConsole(LogLevel.Debug);
    }
}

For NLog

public class LoggingInitiator : ILoggingInitiator {
    public void Initialize(ILoggerFactory loggerFactory) {
        loggerFactory.AddNLog(LogLevel.Debug);
    }
}

Jetski5822 pushed a commit that referenced this issue Apr 17, 2017
* Add Orchard.Logging module adding NLog to pipeline

* Revert "Add Orchard.Logging module adding NLog to pipeline"

This reverts commit b1701fd.

* Added stacktrace and tenant variable to NLog.config

* Storing tenant name  in httpcontext on Cms.Web project

* Added aspnet-traceidentifier to nlog.config

* Fixed middleware registration order

* Replcing middleware per a LayoutRenderer

* Remove unneeded middleware class
Skrypt pushed a commit that referenced this issue Jan 22, 2022
Merge for final round of Elastic Search
DrewScoggins pushed a commit to DrewScoggins/OrchardCore that referenced this issue Dec 9, 2022
DrewScoggins pushed a commit to DrewScoggins/OrchardCore that referenced this issue Dec 1, 2023
Skrypt pushed a commit that referenced this issue Jan 25, 2024
^ This is the 1st commit message:

Add GetCulture() extension method

^ This is the commit message #2:

Cleanup ISmsService (#15142)


^ This is the commit message #3:

Fix TheAdminTheme layout margin and padding (#15143)


^ This is the commit message #4:

Fix SectionDisplayDriver prefix (#15123)


^ This is the commit message #5:

Prefill template name when creating a template. (#15145)


^ This is the commit message #6:

Set the User Localization feature priority

^ This is the commit message #7:

Fix issue with default culture not selected

When currentUserCulture is null or supportedCulture doesn't contain currentUserCulture.

^ This is the commit message #8:

Update the height of the admin content (#15153)


^ This is the commit message #9:

Eliminate the anti-discovery pattern in Elasticsearch (#15134)


^ This is the commit message #10:

Renaming and cleaning up search services (#15156)


^ This is the commit message #11:

mkdocs-material 9.5.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants