public ActionResult <IEnumerable <string> > Get() { LogFourNet.Info(this, "This is Info logging"); LogFourNet.Debug(this, "This is Debug logging"); LogFourNet.Error(this, "This is Error logging"); return(new string[] { "value1", "value2" }); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); LogFourNet.Configure(); AutofacConfiguration.Configure(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseCors("CorsPolicy"); app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/AssetManagementV1/swagger.json", "Asset Management V1"); //c.RoutePrefix = String.Empty; }); var all = Assembly .GetEntryAssembly() .GetReferencedAssemblies() .Select(Assembly.Load) .SelectMany(x => x.DefinedTypes) .Where(type => typeof(ControllerBase).GetTypeInfo().IsAssignableFrom(type.AsType())).Select(x => x.Assembly).ToList(); foreach (var item in all) { LogFourNet.SetUp(item, "log4net.config"); } app.UseHttpsRedirection(); app.UseMvc(); }
public ActionResult <IEnumerable <string> > Get() { LogFourNet.Info(this, "I am a simple test of logging--3"); return(new string[] { "value1", "value2" }); }
// GET api/values public ValuesController() { LogFourNet.SetUp(Assembly.GetEntryAssembly(), "log4net.config"); }