Re: New log file header

2004-03-05 Thread Alexander Gottwald
On Fri, 5 Mar 2004, Takuma Murakami wrote:

> > > 2. Could you add a time-stamp at beginning of each line ?
> > >I tried to correspond the log messages with external actions (i.e.
> > >copy/paste and Emacs errors) and the time stamp could help.
> > 
> > That is an interesting idea.  I think we can do something like that 
> > because we have a single "ErrorF" function that handles printing the log 
> > messages.  We should be able to modify this one function to get 
> > timestamps on all entries... but it may not look too pretty since it 
> > will mess with multiple-line error messages that come from other parts 
> > of the source code.  If those lines are printed with multiple ErrorF 
> > calls, then things will line up correctly.  However, if they are printed 
> > with a single call to ErrorF with multiple "\n"'s, then it may not look 
> > so good.  Of course, we could substitute each "\n" in the format string 
> > (except for the last) with "\n%TIME%", which would help to keep things 
> > aligned.
> > 
> > I dunno... I will have to think about this a bit.
> 
> In my humble opinion, time stamps are very good for debugging
> but might be slightly too verbose for average users.  Additionally
> it could reduce readability of log files.
> 
> I think a kind of log level (verbosity level) is desired so
> that XWiin will print time stamps if -verbose or -debug flag
> is specified.  However I can't contribute right now so I honor
> implementor's choice.

There is already a -loglevel switch. All logfunction (ErrorF, winErrorVerb ...)
will end up in winMsg (AFAIR). You can add the timestamp there. currently the 
default loglevel is 2 (afair). Maybe loglevel 3 or 4 is a good choice for 
adding the timestamp.

bye
[EMAIL PROTECTED]
-- 
 [EMAIL PROTECTED] 
 http://www.gotti.org   ICQ: 126018723
 Chemnitzer Linux-Tag 2004 - 6. und 7. März 2004
 http://www.tu-chemnitz.de/linux/tag


Re: New log file header

2004-03-04 Thread Takuma Murakami
> > 2. Could you add a time-stamp at beginning of each line ?
> >I tried to correspond the log messages with external actions (i.e.
> >copy/paste and Emacs errors) and the time stamp could help.
> 
> That is an interesting idea.  I think we can do something like that 
> because we have a single "ErrorF" function that handles printing the log 
> messages.  We should be able to modify this one function to get 
> timestamps on all entries... but it may not look too pretty since it 
> will mess with multiple-line error messages that come from other parts 
> of the source code.  If those lines are printed with multiple ErrorF 
> calls, then things will line up correctly.  However, if they are printed 
> with a single call to ErrorF with multiple "\n"'s, then it may not look 
> so good.  Of course, we could substitute each "\n" in the format string 
> (except for the last) with "\n%TIME%", which would help to keep things 
> aligned.
> 
> I dunno... I will have to think about this a bit.

In my humble opinion, time stamps are very good for debugging
but might be slightly too verbose for average users.  Additionally
it could reduce readability of log files.

I think a kind of log level (verbosity level) is desired so
that XWiin will print time stamps if -verbose or -debug flag
is specified.  However I can't contribute right now so I honor
implementor's choice.

Takuma Murakami



Re: New log file header

2004-03-03 Thread Harold L Hunt II
Ehud Karni wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Tue, 02 Mar 2004 23:38:52 -0500, Harold L Hunt II <[EMAIL PROTECTED]> wrote:

The new header in the log file, as of XFree86-xserv-4.3.0-49, looks like
the following:
===
Welcome to the XWin X Server
Vendor: The Cygwin/X Project
Release: 4.3.0.49
Contact: cygwin-xfree at cygwin daught com
XWin was started with the following command line:

XWin :0 -multiwindow -clipboard

ddxProcessArgument - Initializing default screens
[...]
===


This change is very good, but there are 2 notes:

1. The Identification (Welcome ... Contact) appears twice (at the top
   and just after "winInitializeDefaultScreens".
Actually, I saw that and fixed it about an hour after the release of 
-49.  So, there were two -49 releases, one of them silent. :)  I figured 
the number of users getting the new release within the first hour would 
be small.  -50 has the same fix.

2. Could you add a time-stamp at beginning of each line ?
   I tried to correspond the log messages with external actions (i.e.
   copy/paste and Emacs errors) and the time stamp could help.
That is an interesting idea.  I think we can do something like that 
because we have a single "ErrorF" function that handles printing the log 
messages.  We should be able to modify this one function to get 
timestamps on all entries... but it may not look too pretty since it 
will mess with multiple-line error messages that come from other parts 
of the source code.  If those lines are printed with multiple ErrorF 
calls, then things will line up correctly.  However, if they are printed 
with a single call to ErrorF with multiple "\n"'s, then it may not look 
so good.  Of course, we could substitute each "\n" in the format string 
(except for the last) with "\n%TIME%", which would help to keep things 
aligned.

I dunno... I will have to think about this a bit.

   I use the code below in my programs.
Thanks, this will help.

BTW. I could not download 4.3.0-50 from the mirrors yet.
Some mirrors update hourly, others daily or every two days.  You can try 
to find a more up-to-date mirror if you like.

Harold


Re: New log file header

2004-03-03 Thread Ehud Karni
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Tue, 02 Mar 2004 23:38:52 -0500, Harold L Hunt II <[EMAIL PROTECTED]> wrote:
>
> The new header in the log file, as of XFree86-xserv-4.3.0-49, looks like
> the following:
>
> ===
> Welcome to the XWin X Server
> Vendor: The Cygwin/X Project
> Release: 4.3.0.49
> Contact: cygwin-xfree at cygwin daught com
>
> XWin was started with the following command line:
>
> XWin :0 -multiwindow -clipboard
>
> ddxProcessArgument - Initializing default screens
> [...]
> ===

This change is very good, but there are 2 notes:

1. The Identification (Welcome ... Contact) appears twice (at the top
   and just after "winInitializeDefaultScreens".

2. Could you add a time-stamp at beginning of each line ?
   I tried to correspond the log messages with external actions (i.e.
   copy/paste and Emacs errors) and the time stamp could help.

   I use the code below in my programs.

BTW. I could not download 4.3.0-50 from the mirrors yet.

Ehud.


#include 
#include   /* for day / hour check */

void  write_date_time ( FILE *fl ) ;   /* write date & time in "dd/mm/yy HH:MM:SS 
" */
void  write_date ( FILE *fl ) ;/* write date in "dd/mm:yy " */
void  write_time ( FILE *fl ) ;/* write time in "HH:MM:SS " */

static int get_ofst ( void ) ; /* compute offset from GMT */


static int  sec_ofst = 1 ; /* seconds offset from Greenwich M. T. */
static int  saved_day = 99 ;   /* initial high value */
static char p_date [ 10 ] ;/* edited date - dd:mm:yy */


void  write_date_time ( FILE *fl ) /* write date & time in "dd/mm/yy HH:MM:SS 
" */
{
   write_date ( fl ) ; /* write date */
   write_time ( fl ) ; /* write time */
}
/*===*/

void  write_date ( FILE *fl )  /* write date in "dd/mm:yy " */
{
   if ( sec_ofst == 1 )
   sec_ofst = get_ofst ( ) ;   /* get offset (1 time only) */
   fprintf ( fl , "%s " , p_date ) ;   /* dd:mm:yy_ format */
}
/*===*/

void  write_time ( FILE *fl )  /* write time in " HH:MM:SS " */
{
int  sec, min, hr;
time_t tloc ;  /* seconds from 1/1/1970 0.0.0 GMT */

   if ( sec_ofst == 1 )
   sec_ofst = get_ofst ( ) ;   /* get offset (1 time only) */
   time (& tloc) ; /* get gmt seconds from 1/1/1970 */
   tloc += sec_ofst ;  /* seconds - local time */
   sec = tloc % 60 ;   /* seconds = time MOD 60 */
   tloc /= 60 ;/* convert to minutes */
   min = tloc % 60 ;   /* minuets = (time/60) MOD 60 */
   tloc /= 60 ;/* convert to hours */
   hr = tloc % 24 ;/* hours = (time/3600) MOD 24 */
   tloc /= 24 ;/* days (local time) */
   if ( tloc > saved_day ) /* day change ? */
   sec_ofst = 1 ;  /* re-compute date next time */
   saved_day = tloc ;  /* save days (local time) */
   fprintf ( fl , "%02d:%02d:%02d ",hr,min,sec) ;   /* _hh:mm:ss_ format */
}
/*===*/

static int get_ofst ( void )   /* compute offset from GMT */
{
#define FDAY 86400 /* full day in seconds 24*60*60 */
#define HDAY 43200 /* half day in seconds */
struct tm ofst;
time_t tloc ;  /* seconds from 1/1/1970 0.0.0 GMT */
int sec_ofst ;

   time (& tloc) ; /* get current time */
   ofst = *gmtime (& tloc) ;   /* find GMT hour */
   sec_ofst = ( ofst.tm_hour * 60 +
ofst.tm_min ) * 60 +
ofst.tm_sec ;  /* GMT hour (in seconds) */
   ofst = *localtime (& tloc) ;/* find local hour */
   sec_ofst = ( ( ofst.tm_hour * 60 +
  ofst.tm_min ) * 60 +
  ofst.tm_sec - sec_ofst
+ FDAY ) % FDAY ;  /* Local - GMT hours (in seconds, 0-FDAY) */
   if ( sec_ofst > HDAY )
   sec_ofst -= FDAY ;  /* sec_ofst in range -11:59:59 +12:00:00 */
   sprintf ( p_date , "%02d/%02d/%02d" ,   /* save date */
 ofst.tm_mday ,
 ( ofst.tm_mon + 1 ) ,
 ( ofst.tm_year % 100 ) ) ;
   return ( sec_ofst ) ;
}
/**/


- --
 Ehud Karni   Tel: +972-3-7966-561  /"\
 Mivtach - Simon  Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   

New log file header

2004-03-02 Thread Harold L Hunt II
The new header in the log file, as of XFree86-xserv-4.3.0-49, looks like 
the following:

===
Welcome to the XWin X Server
Vendor: The Cygwin/X Project
Release: 4.3.0.49
Contact: cygwin-xfree at cygwin daught com
XWin was started with the following command line:

XWin :0 -multiwindow -clipboard

ddxProcessArgument - Initializing default screens
[...]
===
The release number 4.3.0.49 corresponds exactly to 4.3.0-49 of the 
XFree86-xserv package.  This number should always match the version of 
the XFree86-xserv package with each future release.

The contact information is in the log file so that no one can claim that 
they did not know whom to email when they send me log snippits :)

The command line information is there because we need it for diagnosing 
problems, but it is also there because we are all human and sometimes 
the way that we started XWin.exe differs from the way that we thought we 
started it.

In addition to this new log header most of the same information is 
presented in a popup message box when the server crashes and FatalError 
is called.  Finally, this information is also presented when a command 
line argument is malformed (e.g. -screen what), when an invalid command 
line argument is passed (e.g. -junk), or when help is requested (e.g. 
-help).  This popup box tells the user to look at /tmp/XWin.log for more 
information.  The next step here would be to present the DOS path to 
/tmp/XWin.log so that a user with a little less knowledge will be able 
to find the file.

I am pretty proud of this collection of little features: I think they 
are going to result in an improved image for Cygwin/X since users will 
feel empowered while also saving us time from having to prompt people to 
send us the information that we need; it should also eliminate a lot of 
mistakes in the reporting of that information.  Lets hope that this is 
the best Cygwin/X release ever :)

Harold