コード例 #1
0
 protected override void Append(LoggingEvent loggingEvent)
 {
     var dbLoggingEventArgs = new DBLoggingEventArgs
             {
                 DataTime = loggingEvent.TimeStamp,
                 Level = loggingEvent.Level.ToString(),
                 LoggerName = loggingEvent.LoggerName,
                 ThreadName = loggingEvent.ThreadName,
                 Message = loggingEvent.MessageObject.ToString(),
                 FormattedMessage = RenderLoggingEvent(loggingEvent),
             };
     var server = (PGIServer)Enum.Parse(typeof (PGIServer), DB, true);
     DBLoggingService.Instance.Broadcast(server, ApplicationName, dbLoggingEventArgs);
 }
コード例 #2
0
        public void Broadcast(PGIServer server, string applicationName, DBLoggingEventArgs loggingInfo)
        {
            if (_entMgr == null)
            {
                _entMgr = AuthenticationUtils.GetSqlEntityManager(
                    LoginTypeEnum.WindowsActiveDirectory,
                    applicationName,
                    server, PGIDB.SmartBase
                    );
            }

            if (AppLog == null)
            {
                AppLog = UIUtils.LogApplicationOpen(_entMgr, applicationName, _entMgr.CurrentStaff);
            }
            //%d [%thread] %-5level %logger [%ndc] - %message%newline%exception
            AppLog.Comments += loggingInfo.FormattedMessage + "|";
            AppLog.Save();
        }