Closed Towmeykaw closed 7 years ago
Hej @Towmeykaw 👋 - thanks for reporting this!
It looks like you are running the 2.0 branch - exciting! The code you provided looks great, I think the problem is how RawRabbit resolves it's class specific loggers.
Internal loggers are provided by LogManager
, typically through a call like this:
_logger = LogManager.GetLogger<ChannelFactory>();
The idea is that during the registration of the bus client, the Log Manager gets assigned it's registered logging factory. Today it done here. It looks like that code is not being executed when registering the client through the IServiceCollection
extension method.
This will be addressed in the next pre-release of 2.0. In the mean while, you can either do do what you proposed above, alternatively skip the registration of the logger factory and add register it in the log factory yourself
var serilog = new LoggerConfiguration().CreateLogger();
LogManager.CurrentFactory = new RawRabbit.Logging.Serilog.LoggerFactory(serilog);
Hope this helps!
Okay great! I will keep playing around and look forward to the next release 👍
Heya @Towmeykaw - this issue is fixed in beta6! Happy coding
@pardahlman I am doing something similar
DependencyInjection = ioc
=> ioc.AddSingleton<ILoggerFactory, RawRabbit.Logging.Serilog.LoggerFactory>()
But the ILoggerFactory that is being implemented by RawRabbit.Logging.Serilog.LoggerFactory is not the same as the one in Microsoft.Extensions.Logging. Which ILoggerFactory should I be using then for this?
Hey @raime910 I have the same problem. We would be greatfull if you could repeat @pardahlman
When i try to use DI to add the Serilog logger to my application i run into some issues. I have Serilog setup to log to a file but when i do this no RawRabbit logs are written
But if i do this then it works
Don`t know if i am doing something wrong when setting it up? And thanks for a great library!