commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jfcl...@apache.org
Subject cvs commit: jakarta-commons-sandbox/daemon/src/native/nt/procrun procrun.c
Date Fri, 08 Aug 2003 10:34:31 GMT
jfclere     2003/08/08 03:34:31

  Modified:    daemon/src/native/nt/procrun procrun.c
  Log:
  Arrange tracing when debug.
  
  Revision  Changes    Path
  1.25      +32 -22    jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.c
  
  Index: procrun.c
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- procrun.c	17 Jun 2003 16:46:24 -0000	1.24
  +++ procrun.c	8 Aug 2003 10:34:31 -0000	1.25
  @@ -127,6 +127,15 @@
   #endif
   
   #ifdef _DEBUG
  +void log_write(char *string)
  +{
  +    FILE *fd;
  +    fd = fopen("c:\\jakarta-service.txt","a");
  +    if (fd == NULL)
  +	return;
  +    fprintf(fd,string);
  +    fclose(fd);
  +}
   void dbprintf(char *format, ...)
   {
       va_list args;
  @@ -155,6 +164,7 @@
               write(g_proc_stderr_file, tid, strlen(tid));
           else
               fprintf(stderr,tid);
  +	log_write(tid);
   #ifdef _DEBUG_TRACE
           OutputDebugString(tid);
   #endif
  @@ -794,7 +804,7 @@
           return 0;
   
       sprintf(skey, PROCRUN_REGKEY_RPARAMS, proc->service.name);
  -    DBPRINTF1("getting %s\n", skey);
  +    DBPRINTF1("getting key: %s\n", skey);
       if ((err = RegOpenKeyEx(HKEY_LOCAL_MACHINE, skey,
                               0, KEY_READ, &key)) == ERROR_SUCCESS) {
   
  @@ -1033,9 +1043,9 @@
                   proc->java.jpath = procrun_guess_java_home(proc);
               }
           }
  -        DBPRINTF1("jvm dll path %s", proc->java.path);
  -        DBPRINTF1("java    path %s", proc->java.jpath);
  -        DBPRINTF1("java    bin  %s", proc->java.jbin);
  +        DBPRINTF1("jvm dll path %s\n", proc->java.path);
  +        DBPRINTF1("java    path %s\n", proc->java.jpath);
  +        DBPRINTF1("java    bin  %s\n", proc->java.jbin);
           if (!proc->java.path || !proc->java.start_method)
               return -1;
           /* Try to load the jvm dll */ 
  @@ -1138,7 +1148,7 @@
       if (proc->java.stop_bridge && proc->java.stop_mid) {
           jclass strclass;
           jarray jargs = NULL;
  -        DBPRINTF1("Calling shutdown %s", proc->java.stop_class); 
  +        DBPRINTF1("Calling shutdown %s\n", proc->java.stop_class); 
   
           strclass = (*env)->FindClass(env, "java/lang/String");
           if (proc->java.stop_param) {
  @@ -1163,7 +1173,7 @@
               goto cleanup;
           report_service_status(SERVICE_STOPPED, 0, 0,
                                 g_env->m);
  -        DBPRINTF0("Forcing shutdown using System.exit(0)");
  +        DBPRINTF0("Forcing shutdown using System.exit(0)\n");
    
           (*env)->CallStaticVoidMethod(env, sysclass, exitid, 0);
       }
  @@ -1589,7 +1599,7 @@
                          LOGON32_PROVIDER_DEFAULT,
                          &user)) {
               DBPRINTF0(NULL);
  -            DBPRINTF0("LogonUser failed");
  +            DBPRINTF0("LogonUser failed\n");
               return -1;
           }
   
  @@ -2297,23 +2307,23 @@
   {
       int   qreturn;
       if (msg == WM_CREATE) {
  -        DBPRINTF0("ttyConsoleCtrlWndProc WM_CREATE");
  +        DBPRINTF0("ttyConsoleCtrlWndProc WM_CREATE\n");
           return 0;
       } else if (msg == WM_DESTROY) {
  -        DBPRINTF0("ttyConsoleCtrlWndProc WM_DESTROY");
  +        DBPRINTF0("ttyConsoleCtrlWndProc WM_DESTROY\n");
           return 0;
       } else if (msg == WM_CLOSE) {
           /* Call StopService?. */
  -        DBPRINTF0("ttyConsoleCtrlWndProc WM_CLOSE");
  +        DBPRINTF0("ttyConsoleCtrlWndProc WM_CLOSE\n");
           return 0; /* May return 1 if StopService failed. */
       } else if ((msg == WM_QUERYENDSESSION) || (msg == WM_ENDSESSION)) {
           if (lParam & ENDSESSION_LOGOFF) {
               /* Here we have nothing to our hidden windows should stay. */
  -            DBPRINTF0(TEXT("ttyConsoleCtrlWndProc LOGOFF"));
  +            DBPRINTF0(TEXT("ttyConsoleCtrlWndProc LOGOFF\n"));
               return(1); /* Otherwise it cancels the logoff */
           } else {
               /* Stop Service. */
  -            DBPRINTF0("ttyConsoleCtrlWndProc SHUTDOWN");
  +            DBPRINTF0("ttyConsoleCtrlWndProc SHUTDOWN\n");
               SetEvent(g_env->m->events[0]);
   
               return(1); /* Otherwise it cancels the shutdown. */
  @@ -2345,7 +2355,7 @@
       wc.lpszClassName = "ApacheJakartaService";
    
       if (!RegisterClass(&wc)) {
  -        DBPRINTF0("RegisterClass failed");
  +        DBPRINTF0("RegisterClass failed\n");
           return 0;
       }
    
  @@ -2359,7 +2369,7 @@
                                   GetModuleHandle(NULL), NULL);
    
       if (!monitor_hwnd) {
  -        DBPRINTF0("RegisterClass failed");
  +        DBPRINTF0("RegisterClass failed\n");
           return 0;
       }
    
  @@ -2388,21 +2398,21 @@
       /* Make sure the process will resist logoff */
       hkernel = LoadLibrary("KERNEL32.DLL");
       if (!hkernel) {
  -        DBPRINTF0("LoadLibrary KERNEL32.DLL failed");
  +        DBPRINTF0("LoadLibrary KERNEL32.DLL failed\n");
           return 0;
       }
       register_service_process = (DWORD (WINAPI *)(DWORD, DWORD)) 
           GetProcAddress(hkernel, "RegisterServiceProcess");
       if (register_service_process == NULL) {
  -        DBPRINTF0("dlsym RegisterServiceProcess failed");
  +        DBPRINTF0("dlsym RegisterServiceProcess failed\n");
           return 0;
       }
       if (!register_service_process(0,TRUE)) {
           FreeLibrary(hkernel);
  -        DBPRINTF0("register_service_process failed");
  +        DBPRINTF0("register_service_process failed\n");
           return 0;
       }
  -    DBPRINTF0("procrun registered as a service");
  +    DBPRINTF0("procrun registered as a service\n");
   
       /*
        * To be handle notice the shutdown, we need a thread and window.
  @@ -2413,7 +2423,7 @@
           CloseHandle(hThread);
           return TRUE;
        }
  -    DBPRINTF0("jsvc shutdown listener start failed");
  +    DBPRINTF0("jsvc shutdown listener start failed\n");
       return TRUE;
   }
   
  @@ -2603,7 +2613,7 @@
           if (osver.dwPlatformId >= VER_PLATFORM_WIN32_NT)
               g_is_windows_nt = 1;
       }
  -    DBPRINTF1("OS Version %d", g_is_windows_nt);
  +    DBPRINTF1("OS Version %d\n", g_is_windows_nt);
   
       SetConsoleCtrlHandler((PHANDLER_ROUTINE)console_ctrl, TRUE);
       env->m->pool = pool_create();
  @@ -2696,7 +2706,7 @@
               else {
                 // rv = procrun_update_service9x(env->m, argc, argv);
                   rv = -1;
  -                DBPRINTF0("UPDATE SERVICE is unimplemented on 9x for now");
  +                DBPRINTF0("UPDATE SERVICE is unimplemented on 9x for now\n");
               }
               break;
           case PROCRUN_CMD_DELETE_SERVICE:
  @@ -2707,7 +2717,7 @@
               break;
           case PROCRUN_CMD_STOP_SERVICE:
               rv = -1;
  -            DBPRINTF0("STOP SERVICE is unimplemented for now");
  +            DBPRINTF0("STOP SERVICE is unimplemented for now\n");
               break;
           case PROCRUN_CMD_RUN_SERVICE:
               if (g_proc_stderr_file==0) {
  
  
  

Mime
View raw message