-
Notifications
You must be signed in to change notification settings - Fork 26
Logging
you can use the Puck logger to log exceptions and there is a log viewer in the backoffice, in the developer section to see and filter through logs.
you can inject the logger into your controllers:
using puck.core.Abstract;
public class CustomController : BaseController
{
private readonly I_Log _logger;
public CustomController(I_Log logger)
{
_logger = logger;
}
[Route("Custom/Action")]
public IActionResult Action()
{
try{
//do stuff
}catch(Exception ex){
_logger.Log(ex);
}
return View();
}
}
there is also an overload where you can be more specific about what you're logging.
if you are using a load balanced setup, you will need to log into the back office for a specific instance to view its logs. if load balancing using an Azure app service you can log into any instance and view logs for all instances since app service instances share the same file system when scaled out.
logs are stored in the App_Data/Log/{MachineName}/
folder. i prefered to keep the old pre-dotnet-core folder naming for App_Data
rather than naming it something new. naming things is hard.