Log each ppp line to separate /var/log/ppp.tunX.log instead mixing of

all lines into single /var/log/ppp.log
This commit is contained in:
Andrey A. Chernov 1997-05-04 02:39:04 +00:00
parent 653abe61a6
commit 63202ff1e6
7 changed files with 36 additions and 27 deletions

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: defs.h,v 1.11 1997/04/14 23:48:13 brian Exp $ * $Id: defs.h,v 1.12 1997/04/21 01:01:41 brian Exp $
* *
* TODO: * TODO:
*/ */
@ -36,7 +36,7 @@
/* /*
* Check follwiing definitions for your machine envirinment * Check follwiing definitions for your machine envirinment
*/ */
#define LOGFILE "/var/log/ppp.log" /* Name of log file */ #define LOGFILE "/var/log/ppp.tun%d.log" /* Name of log file */
#ifdef __FreeBSD__ #ifdef __FreeBSD__
#define MODEM_DEV "/dev/cuaa1" /* name of tty device */ #define MODEM_DEV "/dev/cuaa1" /* name of tty device */
#else #else

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: log.c,v 1.7 1997/02/22 16:10:26 peter Exp $ * $Id: log.c,v 1.8 1997/03/13 14:53:53 brian Exp $
* *
*/ */
#include "defs.h" #include "defs.h"
@ -42,7 +42,7 @@
static FILE *logfile; static FILE *logfile;
#endif #endif
static char logbuff[2000]; static char logbuff[2000];
static char *logptr; char *logptr;
static struct mbuf *logtop; static struct mbuf *logtop;
static struct mbuf *lognext; static struct mbuf *lognext;
static int logcnt; static int logcnt;
@ -62,12 +62,16 @@ ListLog()
} }
int int
LogOpen() LogOpen(tunno)
int tunno;
{ {
#ifdef USELOGFILE #ifdef USELOGFILE
logfile = fopen(LOGFILE, "a"); char buf[80];
sprintf(buf, LOGFILE, tunno);
logfile = fopen(buf, "a");
if (logfile == NULL) { if (logfile == NULL) {
fprintf(stderr, "can't open %s.\r\n", LOGFILE); fprintf(stderr, "can't open %s.\r\n", buf);
return(1); return(1);
} }
#endif #endif
@ -122,6 +126,7 @@ LogClose()
#ifdef USELOGFILE #ifdef USELOGFILE
fclose(logfile); fclose(logfile);
#endif #endif
logptr = NULL;
} }
#ifdef NO_VSPRINTF #ifdef NO_VSPRINTF
@ -285,12 +290,14 @@ void
LogReOpen( sig ) LogReOpen( sig )
int sig; int sig;
{ {
FILE *nlogfile;
#ifdef USELOGFILE #ifdef USELOGFILE
nlogfile = fopen(LOGFILE, "a"); FILE *nlogfile;
char buf[80];
sprintf(buf, LOGFILE, tunno);
nlogfile = fopen(buf, "a");
if (nlogfile == NULL) { if (nlogfile == NULL) {
LogPrintf(~0,"can't re-open %s.\r\n", LOGFILE); LogPrintf(~0,"can't re-open %s.\r\n", buf);
} }
else { else {
LogPrintf(~0,"log file closed due to signal %d.\r\n",sig); LogPrintf(~0,"log file closed due to signal %d.\r\n",sig);

View File

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: log.h,v 1.8 1997/02/22 16:10:27 peter Exp $ * $Id: log.h,v 1.9 1997/03/13 14:53:54 brian Exp $
* *
* TODO: * TODO:
*/ */
@ -58,10 +58,11 @@
# define LM_CARRIER "Carrier" # define LM_CARRIER "Carrier"
#define MAXLOGLEVEL 10 #define MAXLOGLEVEL 10
extern int loglevel; extern int loglevel, tunno;
extern char *logptr;
extern void LogTimeStamp __P((void)); extern void LogTimeStamp __P((void));
extern int LogOpen __P((void)); extern int LogOpen __P((int));
extern void LogReOpen __P((int)); extern void LogReOpen __P((int));
extern void DupLog __P((void)); extern void DupLog __P((void));
extern void LogClose __P((void)); extern void LogClose __P((void));

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: main.c,v 1.44 1997/04/14 23:48:15 brian Exp $ * $Id: main.c,v 1.45 1997/04/21 01:01:48 brian Exp $
* *
* TODO: * TODO:
* o Add commands for traffic summary, version display, etc. * o Add commands for traffic summary, version display, etc.
@ -78,6 +78,7 @@ static int server;
static pid_t BGPid = 0; static pid_t BGPid = 0;
struct sockaddr_in ifsin; struct sockaddr_in ifsin;
char pid_filename[128]; char pid_filename[128];
int tunno;
static void static void
TtyInit() TtyInit()
@ -296,8 +297,6 @@ main(argc, argv)
int argc; int argc;
char **argv; char **argv;
{ {
int tunno;
argc--; argv++; argc--; argv++;
mode = MODE_INTER; /* default operation is interactive mode */ mode = MODE_INTER; /* default operation is interactive mode */
@ -312,9 +311,6 @@ char **argv;
fprintf(stderr, "Warning: No default entry is given in config file.\n"); fprintf(stderr, "Warning: No default entry is given in config file.\n");
} }
if (LogOpen())
exit(EX_START);
switch ( LocalAuthInit() ) { switch ( LocalAuthInit() ) {
case NOT_FOUND: case NOT_FOUND:
fprintf(stderr,LAUTH_M1); fprintf(stderr,LAUTH_M1);

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Id: os.c,v 1.14 1997/02/25 14:05:06 brian Exp $ * $Id: os.c,v 1.15 1997/04/15 00:03:36 brian Exp $
* *
*/ */
#include "fsm.h" #include "fsm.h"
@ -294,6 +294,11 @@ int *ptun;
} }
*ptun = unit; *ptun = unit;
if (logptr != NULL)
LogClose();
if (LogOpen(unit))
return(-1);
/* /*
* At first, name the interface. * At first, name the interface.
*/ */

View File

@ -1,5 +1,5 @@
.\" manual page [] for ppp 0.94 beta2 + alpha .\" manual page [] for ppp 0.94 beta2 + alpha
.\" $Id: ppp.8,v 1.29 1997/04/14 23:48:17 brian Exp $ .\" $Id: ppp.8,v 1.30 1997/04/21 01:01:56 brian Exp $
.Dd 20 September 1995 .Dd 20 September 1995
.Os FreeBSD .Os FreeBSD
.Dt PPP 8 .Dt PPP 8
@ -1032,7 +1032,7 @@ ISPs.
.Nm .Nm
is able to generate the following log info into is able to generate the following log info into
.Pa /var/log/ppp.log : .Pa /var/log/ppp.tun0.log :
.Bl -column SMMMMMM -offset indent -compat .Bl -column SMMMMMM -offset indent -compat
.It Li Phase Phase transition log output .It Li Phase Phase transition log output
@ -1110,7 +1110,7 @@ A file to check when
.Nm .Nm
establishes a network level connection. establishes a network level connection.
.Pa /var/log/ppp.log .Pa /var/log/ppp.tun0.log
Logging and debugging information file. Logging and debugging information file.
.Pa /var/spool/lock/Lck..* .Pa /var/spool/lock/Lck..*

View File

@ -1,5 +1,5 @@
.\" manual page [] for ppp 0.94 beta2 + alpha .\" manual page [] for ppp 0.94 beta2 + alpha
.\" $Id: ppp.8,v 1.29 1997/04/14 23:48:17 brian Exp $ .\" $Id: ppp.8,v 1.30 1997/04/21 01:01:56 brian Exp $
.Dd 20 September 1995 .Dd 20 September 1995
.Os FreeBSD .Os FreeBSD
.Dt PPP 8 .Dt PPP 8
@ -1032,7 +1032,7 @@ ISPs.
.Nm .Nm
is able to generate the following log info into is able to generate the following log info into
.Pa /var/log/ppp.log : .Pa /var/log/ppp.tun0.log :
.Bl -column SMMMMMM -offset indent -compat .Bl -column SMMMMMM -offset indent -compat
.It Li Phase Phase transition log output .It Li Phase Phase transition log output
@ -1110,7 +1110,7 @@ A file to check when
.Nm .Nm
establishes a network level connection. establishes a network level connection.
.Pa /var/log/ppp.log .Pa /var/log/ppp.tun0.log
Logging and debugging information file. Logging and debugging information file.
.Pa /var/spool/lock/Lck..* .Pa /var/spool/lock/Lck..*