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
* 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:
*/
@ -36,7 +36,7 @@
/*
* 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__
#define MODEM_DEV "/dev/cuaa1" /* name of tty device */
#else

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* 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"
@ -42,7 +42,7 @@
static FILE *logfile;
#endif
static char logbuff[2000];
static char *logptr;
char *logptr;
static struct mbuf *logtop;
static struct mbuf *lognext;
static int logcnt;
@ -62,12 +62,16 @@ ListLog()
}
int
LogOpen()
LogOpen(tunno)
int tunno;
{
#ifdef USELOGFILE
logfile = fopen(LOGFILE, "a");
char buf[80];
sprintf(buf, LOGFILE, tunno);
logfile = fopen(buf, "a");
if (logfile == NULL) {
fprintf(stderr, "can't open %s.\r\n", LOGFILE);
fprintf(stderr, "can't open %s.\r\n", buf);
return(1);
}
#endif
@ -122,6 +126,7 @@ LogClose()
#ifdef USELOGFILE
fclose(logfile);
#endif
logptr = NULL;
}
#ifdef NO_VSPRINTF
@ -285,12 +290,14 @@ void
LogReOpen( sig )
int sig;
{
FILE *nlogfile;
#ifdef USELOGFILE
nlogfile = fopen(LOGFILE, "a");
FILE *nlogfile;
char buf[80];
sprintf(buf, LOGFILE, tunno);
nlogfile = fopen(buf, "a");
if (nlogfile == NULL) {
LogPrintf(~0,"can't re-open %s.\r\n", LOGFILE);
LogPrintf(~0,"can't re-open %s.\r\n", buf);
}
else {
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
* 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:
*/
@ -58,10 +58,11 @@
# define LM_CARRIER "Carrier"
#define MAXLOGLEVEL 10
extern int loglevel;
extern int loglevel, tunno;
extern char *logptr;
extern void LogTimeStamp __P((void));
extern int LogOpen __P((void));
extern int LogOpen __P((int));
extern void LogReOpen __P((int));
extern void DupLog __P((void));
extern void LogClose __P((void));

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* 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:
* o Add commands for traffic summary, version display, etc.
@ -78,6 +78,7 @@ static int server;
static pid_t BGPid = 0;
struct sockaddr_in ifsin;
char pid_filename[128];
int tunno;
static void
TtyInit()
@ -296,8 +297,6 @@ main(argc, argv)
int argc;
char **argv;
{
int tunno;
argc--; argv++;
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");
}
if (LogOpen())
exit(EX_START);
switch ( LocalAuthInit() ) {
case NOT_FOUND:
fprintf(stderr,LAUTH_M1);

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* 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"
@ -294,6 +294,11 @@ int *ptun;
}
*ptun = unit;
if (logptr != NULL)
LogClose();
if (LogOpen(unit))
return(-1);
/*
* At first, name the interface.
*/

View File

@ -1,5 +1,5 @@
.\" 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
.Os FreeBSD
.Dt PPP 8
@ -1032,7 +1032,7 @@ ISPs.
.Nm
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
.It Li Phase Phase transition log output
@ -1110,7 +1110,7 @@ A file to check when
.Nm
establishes a network level connection.
.Pa /var/log/ppp.log
.Pa /var/log/ppp.tun0.log
Logging and debugging information file.
.Pa /var/spool/lock/Lck..*

View File

@ -1,5 +1,5 @@
.\" 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
.Os FreeBSD
.Dt PPP 8
@ -1032,7 +1032,7 @@ ISPs.
.Nm
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
.It Li Phase Phase transition log output
@ -1110,7 +1110,7 @@ A file to check when
.Nm
establishes a network level connection.
.Pa /var/log/ppp.log
.Pa /var/log/ppp.tun0.log
Logging and debugging information file.
.Pa /var/spool/lock/Lck..*