Пример #1
0
 public static void exception(System.String info, System.Exception e)
 {
     //if (e is StreamsUtil.DirectionalIOException)
     //    ((org.javarosa.core.io.StreamsUtil.DirectionalIOException)e).printStackTrace();
     //else
     Console.WriteLine(e.StackTrace, Console.Error);
     log("exception", (info != null ? info + ": " : "") + WrappedException.printException(e));
 }
Пример #2
0
 public static void  exception(System.String info, System.Exception e)
 {
     if (e is org.javarosa.core.io.StreamsUtil.DirectionalIOException)
     {
         ((org.javarosa.core.io.StreamsUtil.DirectionalIOException)e).printStackTrace();
     }
     else
     {
         SupportClass.WriteStackTrace(e, Console.Error);
     }
     log("exception", (info != null?info + ": ":"") + WrappedException.printException(e));
 }
Пример #3
0
        protected internal static void  logForce(System.String type, System.String message)
        {
            System.Console.Error.WriteLine("logger> " + type + ": " + message);
            if (message.Length > MAX_MSG_LENGTH)
            {
                System.Console.Error.WriteLine("  (message truncated)");
            }

            message = message.Substring(0, (System.Math.Min(message.Length, MAX_MSG_LENGTH)) - (0));
            if (logger != null)
            {
                try
                {
                    System.DateTime tempAux = System.DateTime.Now;
                    //UPGRADE_NOTE: ref keyword was added to struct-type parameters. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1303'"
                    logger.log(type, message, ref tempAux);
                }
                catch (System.SystemException e)
                {
                    //do not catch exceptions here; if this fails, we want the exception to propogate
                    System.Console.Error.WriteLine("exception when trying to write log message! " + WrappedException.printException(e));
                    logger.panic();

                    //be conservative for now
                    //throw e;
                }
            }
        }