Last active
July 18, 2019 11:07
-
-
Save johnmmoss/3486c43c43e13ab16c0d83bd7c128748 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class LogController : ApiController | |
| { | |
| public log4net.Repository.Hierarchy.Hierarchy LogHierarchy | |
| { | |
| get | |
| { | |
| return (log4net.Repository.Hierarchy.Hierarchy)LogManager.GetRepository(); | |
| } | |
| } | |
| // LogManager.GetRepository().LevelMap[logLevel] | |
| [HttpPost] | |
| public IHttpActionResult Level(string level) | |
| { | |
| try | |
| { | |
| var log4netLogLevel = LogHierarchy.LevelMap[level] ?? log4net.Core.Level.All; | |
| LogHierarchy.Root.Level = log4netLogLevel; | |
| LogHierarchy.RaiseConfigurationChanged(EventArgs.Empty); | |
| } | |
| catch (Exception ex) | |
| { | |
| return InternalServerError(ex); | |
| } | |
| return Ok(); | |
| } | |
| [HttpGet] | |
| public IHttpActionResult Level() | |
| { | |
| return Ok(LogHierarchy.Root.Level.ToString()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment