All Downloads are FREE. Search and download functionalities are using the official Maven repository.

Alachisoft.NCache.Common.EventLogUtil Maven / Gradle / Ivy

There is a newer version: 5.3.3
Show newest version
package Alachisoft.NCache.Common;

public class EventLogUtil {
    //Basit: Commented: Event Logs == none
//
//    private static int s_logLevel = 7;
//
//    static
//    {
//        String logLevel = System.Configuration.ConfigurationSettings.AppSettings["NCacheServer.EventLogLevel"];
//
//        if (logLevel != null && !logLevel.equals(""))
//        {
//            logLevel = logLevel.toLowerCase();
////C# TO JAVA CONVERTER NOTE: The following 'switch' operated on a string member and was converted to Java 'if-else' logic:
////			switch (logLevel)
////ORIGINAL LINE: case "error":
//            if (logLevel.equals("error"))
//            {
//                s_logLevel = 1;
//
//            }
////ORIGINAL LINE: case "warning":
//            else if (logLevel.equals("warning"))
//            {
//                s_logLevel = 3;
//
//            }
////ORIGINAL LINE: case "all":
//            else if (logLevel.equals("all"))
//            {
//                s_logLevel = 7;
//            }
//        }
//    }
//
//    /**
//     * Writes an error, warning, information, success audit, or failure audit entry with the given message text to the event log.
//     *
//     * @param msg The string to write to the event log.
//     * @param type One of the EventLogEntryType values.
//     */
//    public static void LogEvent(String source, String msg, EventLogEntryType type, short category, int eventId)
//    {
//        try
//        {
//            int level = (int) type;
//            if ((level & s_logLevel) == level)
//            {
////C# TO JAVA CONVERTER NOTE: The following 'using' block is replaced by its Java equivalent:
////				using (EventLog ncLog = new EventLog("Application"))
//                EventLog ncLog = new EventLog("Application");
//                try
//                {
//                    ncLog.Source = source;
//                    ncLog.WriteEntry(msg, type, eventId, category);
//                }
//                finally
//                {
//                    ncLog.dispose();
//                }
//            }
//        }
//        catch (RuntimeException e)
//        {
//        }
//    }
//
//    /**
//     * Writes an error, warning, information, success audit, or failure audit entry with the given message text to the event log.
//     *
//     * @param msg The string to write to the event log.
//     * @param type One of the EventLogEntryType values.
//     */
//    public static void LogEvent(String msg, EventLogEntryType type)
//    {
//        //LogEvent("NCache", msg, type);
//    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy