U4-1381 - LogTypes.Error Intellisense tells to use LogHelper but is Internal

Created by Richard Soeteman 02 Jan 2013, 10:52:53 Updated by Morten Christensen 22 May 2013, 13:23:27

When using logging use Log.Add(LogTypes.Error.... The message "umbraco.BusinessLogic.LogTypes.Error is obsolete: 'Use LogHelper to write error log messages"

This is not possible because the LogHelper is an Internal class.


Sebastiaan Janssen 02 Jan 2013, 11:36:44

I don't see a problem in making the LogHelper public, but I'm not sure if there's a specific reason that it is currently not. Shannon / Morten?

Richard Soeteman 02 Jan 2013, 11:50:40

If it can't me made public then it might be better to remove the obsolete message on LogTypes.Error

Shannon Deminick 02 Jan 2013, 22:55:43

yes, it should be public, will change. Thx!

Eric Schrepel 12 Apr 2013, 18:39:25

Is LogHelper public now? I'm confused how to use it in a Razor script to log a macro's progress. Was using Log.Add("LogTypes.Custom, node.Id, "log message") which worked but created the message above. Trying to switch to something like LogHelper.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, node.Id+": log message") but there must be some @using statement I need at the top to make it work?

Sebastiaan Janssen 13 Apr 2013, 10:09:30

@Eric Umbraco.Core.Logging is where the LogHelper lives.

Pete Duncanson 22 May 2013, 10:34:36

Any examples on how to use this logger? It seems as verbose as the old method at the minute if not more so?

Morten Christensen 22 May 2013, 13:23:27

LogHelper.Info("Look at me I'm logging!"); LogHelper.Info("Now I'm including formatted {0}", () => { return "strings"; }); and the same can be done with LogHelper.Debug, LogHelper.Error and LogHelper.Warn. For more details you'll have to look at the method signatures or current usages in the core.

Priority: Normal

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions: 6.0.0

Due in version: 6.0.0


Story Points: