You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gm...@apache.org on 2018/04/03 20:20:32 UTC
qpid-dispatch git commit: DISPATCH-918 - Deprecated some attributes
of the log entities and and introduced replacements with clearer names
Repository: qpid-dispatch
Updated Branches:
refs/heads/master 45f8833a0 -> 81fdd61fd
DISPATCH-918 - Deprecated some attributes of the log entities and and introduced replacements with clearer names
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/81fdd61f
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/81fdd61f
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/81fdd61f
Branch: refs/heads/master
Commit: 81fdd61fd2bf06884ce903055a1dce16dc91cf3d
Parents: 45f8833
Author: Ganesh Murthy <gm...@redhat.com>
Authored: Tue Apr 3 16:20:14 2018 -0400
Committer: Ganesh Murthy <gm...@redhat.com>
Committed: Tue Apr 3 16:20:14 2018 -0400
----------------------------------------------------------------------
doc/new-book/configuration-reference.adoc | 6 ++--
doc/new-book/logging.adoc | 4 +--
doc/new-book/managing-using-qdmanage.adoc | 2 +-
python/qpid_dispatch/management/qdrouter.json | 9 ++++--
.../qpid_dispatch_internal/management/agent.py | 2 +-
src/log.c | 30 ++++++++++----------
tests/policy-2/test-router-with-policy.json.in | 2 +-
tests/system_test.py | 2 +-
tests/system_tests_cmdline_parsing.py | 5 ++--
tests/system_tests_management.py | 8 +++---
tests/system_tests_qdmanage.py | 6 ++--
11 files changed, 40 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/81fdd61f/doc/new-book/configuration-reference.adoc
----------------------------------------------------------------------
diff --git a/doc/new-book/configuration-reference.adoc b/doc/new-book/configuration-reference.adoc
index 9aa88f3..b8d0a99 100644
--- a/doc/new-book/configuration-reference.adoc
+++ b/doc/new-book/configuration-reference.adoc
@@ -154,9 +154,9 @@ Configure logging for a particular module which is part of the router. You can u
* *_module_* (One of [`ROUTER`, `ROUTER_CORE`, `ROUTER_HELLO`, `ROUTER_LS`, `ROUTER_MA`, `MESSAGE`, `SERVER`, `AGENT`, `CONTAINER`, `ERROR`, `POLICY`, `DEFAULT`], required) : Module to configure. The special module `DEFAULT` specifies defaults for all modules.
* *_enable_* (string, default=`default`, required) Levels are: `trace`, `debug`, `info`, `notice`, `warning`, `error`, `critical`. The enable string is a comma-separated list of levels. A level may have a trailing `+` to enable that level and above. For example `trace,debug,warning+` means enable trace, debug, warning, error and critical. The value ‘none’ means disable logging for the module. The value `default` means use the value from the `DEFAULT` module.
-* *_timestamp_* (boolean) : Include timestamp in log messages.
-* *_source_* (boolean) : Include source file and line number in log messages.
-* *_output_* (string) : Where to send log messages. Can be `stderr`, `syslog` or a file name.
+* *_includeTimestamp_* (boolean) : Include timestamp in log messages.
+* *_includeSource_* (boolean) : Include source file and line number in log messages.
+* *_outputFile_* (string) : Where to send log messages. Can be `stderr`, `syslog` or a file name.
[id='router-configuration-file-address']
==== address
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/81fdd61f/doc/new-book/logging.adoc
----------------------------------------------------------------------
diff --git a/doc/new-book/logging.adoc b/doc/new-book/logging.adoc
index 3239358..e2336f9 100644
--- a/doc/new-book/logging.adoc
+++ b/doc/new-book/logging.adoc
@@ -269,7 +269,7 @@ You can specify the types of events that should be logged, the format of the log
log {
module: DEFAULT
enable: _LOGGING_LEVEL_
- timestamp: yes
+ includeTimestamp: yes
...
}
----
@@ -289,7 +289,7 @@ log {
+
To specify multiple levels, use a comma-separated list. You can also use `+` to specify a level and all levels above it. For example, `trace,debug,warning+` enables trace, debug, warning, error, and critical levels. For default logging, you should typically use the `info+` or `notice+` level. These levels will provide general information, warnings, and errors for all modules without affecting the performance of {RouterName}.
//end::logging-levels[]
-`timestamp`:: Set this to `yes` to include the timestamp in all logs.
+`includeTimestamp`:: Set this to `yes` to include the timestamp in all logs.
For information about additional log attributes, see link:{qdrouterdConfManPageUrl}#_log[the `qdrouterd.conf` man page].
--
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/81fdd61f/doc/new-book/managing-using-qdmanage.adoc
----------------------------------------------------------------------
diff --git a/doc/new-book/managing-using-qdmanage.adoc b/doc/new-book/managing-using-qdmanage.adoc
index 25ea4f8..fae8653 100644
--- a/doc/new-book/managing-using-qdmanage.adoc
+++ b/doc/new-book/managing-using-qdmanage.adoc
@@ -659,7 +659,7 @@ qdmanage read --type=log --module=_LOGGING_MODULE_NAME_
a|
[options="nowrap",subs="+quotes"]
----
-qdmanage create --type=log --module=DEFAULT --enable=_LOGGING_LEVEL_ --timestamp=yes --_ATTRIBUTE_=_VALUE_
+qdmanage create --type=log --module=DEFAULT --enable=_LOGGING_LEVEL_ --includeTimestamp=yes --_ATTRIBUTE_=_VALUE_
----
|Enable logging for a logging module
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/81fdd61f/python/qpid_dispatch/management/qdrouter.json
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch/management/qdrouter.json b/python/qpid_dispatch/management/qdrouter.json
index 4a7504d..b32ed0f 100644
--- a/python/qpid_dispatch/management/qdrouter.json
+++ b/python/qpid_dispatch/management/qdrouter.json
@@ -1008,19 +1008,22 @@
"description": "Levels are: trace, debug, info, notice, warning, error, critical. The enable string is a comma-separated list of levels. A level may have a trailing '\\+' to enable that level and above. For example 'trace,debug,warning+' means enable trace, debug, warning, error and critical. The value 'none' means disable logging for the module.",
"update": true
},
- "timestamp": {
+ "includeTimestamp": {
"type": "boolean",
"description": "Include timestamp in log messages.",
+ "deprecationName": "timestamp",
"update": true
},
- "source": {
+ "includeSource": {
"type": "boolean",
"description": "Include source file and line number in log messages.",
+ "deprecationName": "source",
"update": true
},
- "output": {
+ "outputFile": {
"type": "string",
"description": "Where to send log messages. Can be 'stderr', 'stdout', 'syslog' or a file name.",
+ "deprecationName": "output",
"update": true
}
}
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/81fdd61f/python/qpid_dispatch_internal/management/agent.py
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch_internal/management/agent.py b/python/qpid_dispatch_internal/management/agent.py
index ffcd6ff..2d71bba 100644
--- a/python/qpid_dispatch_internal/management/agent.py
+++ b/python/qpid_dispatch_internal/management/agent.py
@@ -257,7 +257,7 @@ class LogEntity(EntityAdapter):
def __init__(self, agent, entity_type, attributes=None, validate=True):
# Special defaults for DEFAULT module.
if attributes.get("module") == "DEFAULT":
- defaults = dict(enable="info+", timestamp=True, source=False, output="stderr")
+ defaults = dict(enable="info+", includeTimestamp=True, includeSource=False, outputFile="stderr")
attributes = dict(defaults, **attributes)
super(LogEntity, self).__init__(agent, entity_type, attributes, validate=True)
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/81fdd61f/src/log.c
----------------------------------------------------------------------
diff --git a/src/log.c b/src/log.c
index 1200089..e8fb73e 100644
--- a/src/log.c
+++ b/src/log.c
@@ -165,8 +165,8 @@ struct qd_log_source_t {
DEQ_LINKS(qd_log_source_t);
char *module;
int mask;
- int timestamp; /* boolean or -1 means not set */
- int source; /* boolean or -1 means not set */
+ int includeTimestamp; /* boolean or -1 means not set */
+ int includeSource; /* boolean or -1 means not set */
bool syslog;
log_sink_t *sink;
uint64_t severity_histogram[N_LEVEL_INDICES];
@@ -298,7 +298,7 @@ static void write_log(qd_log_source_t *log_source, qd_log_entry_t *entry)
qd_error_clear();
}
- if (default_bool(log_source->timestamp, default_log_source->timestamp)) {
+ if (default_bool(log_source->includeTimestamp, default_log_source->includeTimestamp)) {
char buf[100];
buf[0] = '\0';
@@ -311,7 +311,7 @@ static void write_log(qd_log_source_t *log_source, qd_log_entry_t *entry)
aprintf(&begin, end, "%s ", buf);
}
aprintf(&begin, end, "%s (%s) %s", entry->module, level->name, entry->text);
- if (default_bool(log_source->source, default_log_source->source) && entry->file)
+ if (default_bool(log_source->includeSource, default_log_source->includeSource) && entry->file)
aprintf(&begin, end, " (%s:%d)", entry->file, entry->line);
aprintf(&begin, end, "\n");
@@ -334,8 +334,8 @@ static void write_log(qd_log_source_t *log_source, qd_log_entry_t *entry)
/// Reset the log source to the default state
static void qd_log_source_defaults(qd_log_source_t *log_source) {
log_source->mask = -1;
- log_source->timestamp = -1;
- log_source->source = -1;
+ log_source->includeTimestamp = -1;
+ log_source->includeSource = -1;
log_source->sink = 0;
memset ( log_source->severity_histogram, 0, sizeof(uint64_t) * (N_LEVEL_INDICES) );
}
@@ -483,8 +483,8 @@ void qd_log_initialize(void)
default_log_source = qd_log_source(SOURCE_DEFAULT);
default_log_source->mask = levels[INFO].mask;
- default_log_source->timestamp = true;
- default_log_source->source = 0;
+ default_log_source->includeTimestamp = true;
+ default_log_source->includeSource = 0;
default_log_source->sink = log_sink_lh(SINK_STDERR);
}
@@ -516,8 +516,8 @@ qd_error_t qd_log_entity(qd_entity_t *entity) {
qd_log_source_t *src = qd_log_source_lh(module); /* The original(already existing) log source */
- if (qd_entity_has(entity, "output")) {
- output = qd_entity_get_string(entity, "output");
+ if (qd_entity_has(entity, "outputFile")) {
+ output = qd_entity_get_string(entity, "outputFile");
QD_ERROR_BREAK();
log_sink_t* sink = log_sink_lh(output);
QD_ERROR_BREAK();
@@ -529,7 +529,7 @@ qd_error_t qd_log_entity(qd_entity_t *entity) {
src->sink = sink; /* Assign the new sink */
if (src->sink->syslog) /* Timestamp off for syslog. */
- src->timestamp = 0;
+ src->includeTimestamp = 0;
}
if (qd_entity_has(entity, "enable")) {
@@ -539,12 +539,12 @@ qd_error_t qd_log_entity(qd_entity_t *entity) {
}
QD_ERROR_BREAK();
- if (qd_entity_has(entity, "timestamp"))
- src->timestamp = qd_entity_get_bool(entity, "timestamp");
+ if (qd_entity_has(entity, "includeTimestamp"))
+ src->includeTimestamp = qd_entity_get_bool(entity, "includeTimestamp");
QD_ERROR_BREAK();
- if (qd_entity_has(entity, "source"))
- src->source = qd_entity_get_bool(entity, "source");
+ if (qd_entity_has(entity, "includeSource"))
+ src->includeSource = qd_entity_get_bool(entity, "includeSource");
QD_ERROR_BREAK();
} while(0);
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/81fdd61f/tests/policy-2/test-router-with-policy.json.in
----------------------------------------------------------------------
diff --git a/tests/policy-2/test-router-with-policy.json.in b/tests/policy-2/test-router-with-policy.json.in
index 936766e..835bc09 100644
--- a/tests/policy-2/test-router-with-policy.json.in
+++ b/tests/policy-2/test-router-with-policy.json.in
@@ -20,7 +20,7 @@
"port": 21001
}],
["log", {
- "source": "true",
+ "includeTimestamp": "true",
"enable": "trace+",
"module": "DEFAULT"
}],
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/81fdd61f/tests/system_test.py
----------------------------------------------------------------------
diff --git a/tests/system_test.py b/tests/system_test.py
index 4f25fdd..4d5bc64 100755
--- a/tests/system_test.py
+++ b/tests/system_test.py
@@ -320,7 +320,7 @@ class Qdrouterd(Process):
default_log = [l for l in config if (l[0] == 'log' and l[1]['module'] == 'DEFAULT')]
if not default_log:
config.append(
- ('log', {'module':'DEFAULT', 'enable':'trace+', 'source': 'true', 'output':name+'.log'}))
+ ('log', {'module':'DEFAULT', 'enable':'trace+', 'includeSource': 'true', 'outputFile':name+'.log'}))
args = ['qdrouterd', '-c', config.write(name)]
env_home = os.environ.get('QPID_DISPATCH_HOME')
if pyinclude:
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/81fdd61f/tests/system_tests_cmdline_parsing.py
----------------------------------------------------------------------
diff --git a/tests/system_tests_cmdline_parsing.py b/tests/system_tests_cmdline_parsing.py
index db7fc22..e68e6be 100644
--- a/tests/system_tests_cmdline_parsing.py
+++ b/tests/system_tests_cmdline_parsing.py
@@ -48,7 +48,7 @@ class CommandLineTest(TestCase):
cls.config = Qdrouterd.Config([
('router', {'mode': 'standalone', 'id': CommandLineTest.name}),
('listener', {'port': CommandLineTest.testport}),
- ('log',{'module':'DEFAULT', 'enable':'trace+', 'source': 'true', 'output': os.getcwd()+"/"+CommandLineTest.name+'.log'})
+ ('log',{'module':'DEFAULT', 'enable':'trace+', 'includeSource': 'true', 'outputFile': os.getcwd()+"/"+CommandLineTest.name+'.log'})
])
def run_qdrouterd_as_daemon(self, config_file_name, pid_file_name):
@@ -106,10 +106,11 @@ class CommandLineTest2(TestCase):
cls.name = "test-router-2"
CommandLineTest2.testname = cls.name
CommandLineTest2.testport = cls.tester.get_port()
+ # output has been deprecated. We are using it here to test backward compatibility.
cls.config = Qdrouterd.Config([
('router', {'mode': 'standalone', 'id': CommandLineTest2.testname}),
('listener', {'port': CommandLineTest2.testport}),
- ('log',{'module':'DEFAULT', 'enable':'trace+', 'source': 'true', 'output': os.getcwd()+"/"+CommandLineTest2.name+'.log'})
+ ('log',{'module':'DEFAULT', 'enable':'trace+', 'includeSource': 'true', 'output': os.getcwd()+"/"+CommandLineTest2.name+'.log'})
])
def run_qdrouterd_as_daemon(self, config_file_name, pid_file_name):
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/81fdd61f/tests/system_tests_management.py
----------------------------------------------------------------------
diff --git a/tests/system_tests_management.py b/tests/system_tests_management.py
index 626f6d5..253724f 100644
--- a/tests/system_tests_management.py
+++ b/tests/system_tests_management.py
@@ -195,9 +195,9 @@ class ManagementTest(system_test.TestCase):
u'enable': u'trace+',
u'module': u'DEFAULT',
u'name': u'log/DEFAULT',
- u'output': u'logrouter.log',
- u'source': True,
- u'timestamp': True,
+ u'outputFile': u'logrouter.log',
+ u'includeSource': True,
+ u'includeTimestamp': True,
u'type': u'org.apache.qpid.dispatch.log'})
@@ -219,7 +219,7 @@ class ManagementTest(system_test.TestCase):
def update_check_log(attributes, error=True, debug=False):
log_count[0] += 1
log = os.path.abspath("test_log.log%s" % log_count[0])
- attributes["output"] = log
+ attributes["outputFile"] = log
attributes["identity"] = "log/AGENT"
node.update(attributes)
check_log(log, error, debug)
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/81fdd61f/tests/system_tests_qdmanage.py
----------------------------------------------------------------------
diff --git a/tests/system_tests_qdmanage.py b/tests/system_tests_qdmanage.py
index c3c482a..c3c704e 100644
--- a/tests/system_tests_qdmanage.py
+++ b/tests/system_tests_qdmanage.py
@@ -257,7 +257,7 @@ class QdmanageTest(TestCase):
exception = False
try:
# Try to not set 'output'
- json.loads(self.run_qdmanage("UPDATE --type org.apache.qpid.dispatch.log --name log/DEFAULT output="))
+ json.loads(self.run_qdmanage("UPDATE --type org.apache.qpid.dispatch.log --name log/DEFAULT outputFile="))
except Exception as e:
exception = True
self.assertTrue("InternalServerErrorStatus: CError: Configuration: Failed to open log file ''" in e.message)
@@ -265,8 +265,8 @@ class QdmanageTest(TestCase):
# Set a valid 'output'
output = json.loads(self.run_qdmanage("UPDATE --type org.apache.qpid.dispatch.log --name log/DEFAULT "
- "enable=trace+ output=A.log"))
- self.assertEqual("A.log", output['output'])
+ "enable=trace+ outputFile=A.log"))
+ self.assertEqual("A.log", output['outputFile'])
self.assertEqual("trace+", output['enable'])
def create(self, type, name, port):
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org