Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I've created a SurfaceController who uses a custom Service where I log some events.
When I try my code in my machine I can see the logs in the Umbarco backoffice log viewer. But if I deploy my website to Azure, logs stops working.
This is my code:
public class ContactController : SurfaceController { private ISmtpClientService _service; public ContactController(ISmtpClientService service) { _service = service; } [HttpPost] [ValidateAntiForgeryToken] public ActionResult Submit(ContactFormModel model) { if (ModelState.IsValid) { model.Subject = $"Contact form - {model.Name}"; bool success = _service.SendMessage(model); } return RedirectToCurrentUmbracoPage(); } }
And this is the Service I've created:
public class SmtpClientService : ISmtpClientService { private readonly ILogger _logger; public SmtpClientService(ILogger logger) { _logger = logger; } public bool SendMessage(ContactFormModel model) { using (var client = new MailKit.Net.Smtp.SmtpClient()) { try { _logger.Info<SmtpClientService>("Start method.");
Any idea why it is working in my machine but not once I deployed it?
I'm using Umbraco v8.11.1
Thanks!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Logger works in localhost but not deployed on Azure
Hi,
I've created a SurfaceController who uses a custom Service where I log some events.
When I try my code in my machine I can see the logs in the Umbarco backoffice log viewer. But if I deploy my website to Azure, logs stops working.
This is my code:
And this is the Service I've created:
Any idea why it is working in my machine but not once I deployed it?
I'm using Umbraco v8.11.1
Thanks!
is working on a reply...