Application logging in 2024.2?

Has anybody got this working yet? I was trying to put a logger in a function, but using their sample code gives me an error. Cannot find anything like Ice.Logging or Ice.ApplicationLogging to add in the references or services list. What am I missing?


image

2 Likes

Seems like you have to add some stuff yourself.

5 Likes

Didn’t read far enough lol. I was looking for Ice.Logging.

1 Like

To be fair, it should probably have that info near the top, lol.

1 Like

This is kinda neat. Didn’t know this was a thing.

1 Like

In case anybody else is having a hard time following the instructions and needs more pictures too lol:

1 Like

I guess I am still doing it wrong.
[CDATA[System.ObjectDisposedException: Cannot access a disposed object.
Object name: ‘DisposableLogger’.
at Epicor.Hosting.Trace.DisposableLogger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter) in C:_releases\ICE\ICE4.3.200.0\Source\Server\Framework\Epicor.System\Hosting\Trace\DisposableLogger.cs:line 52
at Microsoft.Extensions.Logging.LoggerExtensions.Log(ILogger logger, LogLevel logLevel, EventId eventId, Exception exception, String message, Object args)
at Microsoft.Extensions.Logging.LoggerExtensions.LogInformation(ILogger logger, String message, Object args)

I was trying to put it in the catch

1 Like

I just made it its own function.
That way you can call it from everywhere else.

4 Likes

I will have to try it that way instead

After your code goes out of using(logger){} the logger is disposed.

2 Likes

Yay it worked, had a stray bracket

2 Likes

First of all, I always enjoy looking at your work… the way your mind works is pretty entertaining.

image

Secondly… I may have a problem because when i was reading over your code, I started getting thirsty:
image

My mind reading var logger =

4 Likes