Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
d9a381b9
Unverified
Commit
d9a381b9
authored
Aug 06, 2018
by
2xsec
Committed by
Christian Brauner
Aug 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log: add default log priority
Signed-off-by:
2xsec
<
dh48.jeong@samsung.com
>
parent
4d37bc03
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
log.c
src/lxc/log.c
+15
-3
arguments.c
src/lxc/tools/arguments.c
+6
-0
No files found.
src/lxc/log.c
View file @
d9a381b9
...
@@ -511,7 +511,7 @@ static int __lxc_log_set_file(const char *fname, int create_dirs)
...
@@ -511,7 +511,7 @@ static int __lxc_log_set_file(const char *fname, int create_dirs)
if
(
strlen
(
fname
)
==
0
)
{
if
(
strlen
(
fname
)
==
0
)
{
log_fname
=
NULL
;
log_fname
=
NULL
;
return
0
;
return
-
1
;
}
}
#if USE_CONFIGPATH_LOGS
#if USE_CONFIGPATH_LOGS
...
@@ -559,6 +559,9 @@ int lxc_log_init(struct lxc_log *log)
...
@@ -559,6 +559,9 @@ int lxc_log_init(struct lxc_log *log)
int
ret
;
int
ret
;
int
lxc_priority
=
LXC_LOG_LEVEL_ERROR
;
int
lxc_priority
=
LXC_LOG_LEVEL_ERROR
;
if
(
!
log
)
return
-
1
;
if
(
lxc_log_fd
!=
-
1
)
{
if
(
lxc_log_fd
!=
-
1
)
{
WARN
(
"Log already initialized"
);
WARN
(
"Log already initialized"
);
return
0
;
return
0
;
...
@@ -572,10 +575,9 @@ int lxc_log_init(struct lxc_log *log)
...
@@ -572,10 +575,9 @@ int lxc_log_init(struct lxc_log *log)
lxc_loglevel_specified
=
1
;
lxc_loglevel_specified
=
1
;
}
}
if
(
!
lxc_quiet_specified
)
{
if
(
!
lxc_quiet_specified
)
if
(
!
log
->
quiet
)
if
(
!
log
->
quiet
)
lxc_log_category_lxc
.
appender
->
next
=
&
log_appender_stderr
;
lxc_log_category_lxc
.
appender
->
next
=
&
log_appender_stderr
;
}
if
(
log
->
prefix
)
if
(
log
->
prefix
)
lxc_log_set_prefix
(
log
->
prefix
);
lxc_log_set_prefix
(
log
->
prefix
);
...
@@ -588,6 +590,11 @@ int lxc_log_init(struct lxc_log *log)
...
@@ -588,6 +590,11 @@ int lxc_log_init(struct lxc_log *log)
return
0
;
return
0
;
ret
=
__lxc_log_set_file
(
log
->
file
,
1
);
ret
=
__lxc_log_set_file
(
log
->
file
,
1
);
if
(
ret
<
0
)
{
ERROR
(
"Failed to enable logfile"
);
return
-
1
;
}
lxc_log_use_global_fd
=
1
;
lxc_log_use_global_fd
=
1
;
}
else
{
}
else
{
/* if no name was specified, there nothing to do */
/* if no name was specified, there nothing to do */
...
@@ -621,6 +628,11 @@ int lxc_log_init(struct lxc_log *log)
...
@@ -621,6 +628,11 @@ int lxc_log_init(struct lxc_log *log)
ret
=
0
;
ret
=
0
;
}
}
if
(
lxc_log_fd
!=
-
1
)
{
lxc_log_category_lxc
.
appender
=
&
log_appender_logfile
;
lxc_log_category_lxc
.
appender
->
next
=
&
log_appender_stderr
;
}
return
ret
;
return
ret
;
}
}
...
...
src/lxc/tools/arguments.c
View file @
d9a381b9
...
@@ -192,6 +192,7 @@ extern int lxc_arguments_parse(struct lxc_arguments *args, int argc,
...
@@ -192,6 +192,7 @@ extern int lxc_arguments_parse(struct lxc_arguments *args, int argc,
char
*
const
argv
[])
char
*
const
argv
[])
{
{
int
ret
=
0
;
int
ret
=
0
;
bool
logfile
=
false
;
char
shortopts
[
256
];
char
shortopts
[
256
];
ret
=
build_shortopts
(
args
->
options
,
shortopts
,
sizeof
(
shortopts
));
ret
=
build_shortopts
(
args
->
options
,
shortopts
,
sizeof
(
shortopts
));
...
@@ -215,9 +216,14 @@ extern int lxc_arguments_parse(struct lxc_arguments *args, int argc,
...
@@ -215,9 +216,14 @@ extern int lxc_arguments_parse(struct lxc_arguments *args, int argc,
break
;
break
;
case
'o'
:
case
'o'
:
args
->
log_file
=
optarg
;
args
->
log_file
=
optarg
;
logfile
=
true
;
break
;
break
;
case
'l'
:
case
'l'
:
args
->
log_priority
=
optarg
;
args
->
log_priority
=
optarg
;
if
(
!
logfile
&&
args
->
log_file
&&
strcmp
(
args
->
log_file
,
"none"
)
==
0
)
args
->
log_file
=
NULL
;
break
;
break
;
case
'q'
:
case
'q'
:
args
->
quiet
=
1
;
args
->
quiet
=
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment