You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before using Log4Stash in your personal project, you want to create a console program to test your server with assuming everything works in postman. Tho postman could just be using curl....
but below should allow you to test if your system is working. you will need to modify your config correct. if you can log files to a local folder without issues then it might be a network issue.
`
using System;
using log4net;
using log4net.Config;
using System.IO;
using System.Reflection;
namespace ELKTest
{
internal class Program
{
private static readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
static void Main(string[] args)
{
// Enable log4net internal debugging
log4net.Util.LogLog.InternalDebugging = true;
log4net.Config.XmlConfigurator.Configure();
var logger = LogManager.GetLogger("elk_test");
try
{
// Ensure log4net is configured
var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());
//XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config"));
//log4net.Config.XmlConfigurator.Configure();
//var logger = LogManager.GetLogger("console_test_logger");
logger.Debug("This is a DEBUG message.");
logger.Info("This is an INFO message.");
logger.Warn("This is a WARN message.");
logger.Error("This is an ERROR message.");
Console.WriteLine("Log messages have been sent to Elasticsearch.");
}
catch (Exception ex)
{
Console.WriteLine("Error occurred: " + ex.Message);
}
}
}
Hello, do you have an example on how to configure this package to work with .Net 6?
I have the configuration file, but I can't see any log on kibana.
in program.cs I have
XmlConfigurator.Configure(new FileInfo("log4net.config"));
But what to do in order to get log4stash working?
The text was updated successfully, but these errors were encountered: