You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2014/04/28 23:52:48 UTC
[1/3] git commit: TS-2755: use the proper log rolling enum where we
can
Repository: trafficserver
Updated Branches:
refs/heads/master 81390c57b -> 56e83bda3
TS-2755: use the proper log rolling enum where we can
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/edb3e35b
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/edb3e35b
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/edb3e35b
Branch: refs/heads/master
Commit: edb3e35bc8261e6125e8bba0be97a4a3c141ce0d
Parents: 81390c5
Author: James Peach <jp...@apache.org>
Authored: Fri Apr 25 14:28:46 2014 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Apr 28 14:45:02 2014 -0700
----------------------------------------------------------------------
proxy/InkAPI.cc | 2 +-
proxy/logging/Log.cc | 6 ++---
proxy/logging/Log.h | 33 ++++++++++++++++++++++++++
proxy/logging/LogConfig.cc | 35 ++++++++++++++++++----------
proxy/logging/LogConfig.h | 30 ++----------------------
proxy/logging/LogObject.cc | 51 +++++++++++++++++++++++------------------
proxy/logging/LogObject.h | 11 +++++----
7 files changed, 97 insertions(+), 71 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/edb3e35b/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 44d37b9..4bb2e3f 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -6893,7 +6893,7 @@ TSTextLogObjectRollingEnabledSet(TSTextLogObject the_object, int rolling_enabled
{
sdk_assert(sdk_sanity_check_iocore_structure(the_object) == TS_SUCCESS);
- ((TextLogObject *) the_object)->set_rolling_enabled(rolling_enabled);
+ ((TextLogObject *) the_object)->set_rolling_enabled((Log::RollingEnabledValues)rolling_enabled);
}
void
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/edb3e35b/proxy/logging/Log.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc
index 52bfe16..8107cb1 100644
--- a/proxy/logging/Log.cc
+++ b/proxy/logging/Log.cc
@@ -221,7 +221,7 @@ Log::periodic_tasks(long time_now)
// so that log objects are flushed
//
change_configuration();
- } else if (logging_mode > LOG_MODE_NONE || config->collation_mode == LogConfig::COLLATION_HOST ||
+ } else if (logging_mode > LOG_MODE_NONE || config->collation_mode == Log::COLLATION_HOST ||
config->has_api_objects()) {
Debug("log-periodic", "Performing periodic tasks");
@@ -962,7 +962,7 @@ Log::init(int flags)
"init status = %d", logging_mode, init_status);
init_when_enabled();
if (config_flags & STANDALONE_COLLATOR) {
- config->collation_mode = LogConfig::COLLATION_HOST;
+ config->collation_mode = Log::COLLATION_HOST;
}
config->init();
}
@@ -1478,7 +1478,7 @@ Log::match_logobject(LogBufferHeader * header)
obj = NEW(new LogObject(fmt, Log::config->logfile_dir,
header->log_filename(), file_format, NULL,
- Log::config->rolling_enabled,
+ (Log::RollingEnabledValues)Log::config->rolling_enabled,
Log::config->collation_preproc_threads,
Log::config->rolling_interval_sec,
Log::config->rolling_offset_hr,
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/edb3e35b/proxy/logging/Log.h
----------------------------------------------------------------------
diff --git a/proxy/logging/Log.h b/proxy/logging/Log.h
index 843c1d3..fed3801 100644
--- a/proxy/logging/Log.h
+++ b/proxy/logging/Log.h
@@ -384,6 +384,32 @@ public:
LOGCAT = 4
};
+ enum CollationMode
+ {
+ NO_COLLATION = 0,
+ COLLATION_HOST,
+ SEND_STD_FMTS,
+ SEND_NON_XML_CUSTOM_FMTS,
+ SEND_STD_AND_NON_XML_CUSTOM_FMTS,
+ N_COLLATION_MODES
+ };
+
+ enum RollingEnabledValues
+ {
+ NO_ROLLING = 0,
+ ROLL_ON_TIME_ONLY,
+ ROLL_ON_SIZE_ONLY,
+ ROLL_ON_TIME_OR_SIZE,
+ ROLL_ON_TIME_AND_SIZE,
+ INVALID_ROLLING_VALUE
+ };
+
+ enum
+ {
+ // 5 minute minimum rolling interval
+ MIN_ROLLING_INTERVAL_SEC = 300
+ };
+
// main interface
static void init(int configFlags = 0);
static void init_fields();
@@ -450,4 +476,11 @@ private:
Log & operator=(const Log & rhs);
};
+
+static inline bool
+LogRollingEnabledIsValid(int enabled)
+{
+ return (enabled >= Log::NO_ROLLING || enabled < Log::INVALID_ROLLING_VALUE);
+}
+
#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/edb3e35b/proxy/logging/LogConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogConfig.cc b/proxy/logging/LogConfig.cc
index 3498943..e0c1900 100644
--- a/proxy/logging/LogConfig.cc
+++ b/proxy/logging/LogConfig.cc
@@ -35,6 +35,7 @@
#include "List.h"
#include "InkXml.h"
+#include "Log.h"
#include "LogField.h"
#include "LogFilter.h"
#include "LogFormat.h"
@@ -44,7 +45,6 @@
#include "LogObject.h"
#include "LogConfig.h"
#include "LogUtils.h"
-#include "Log.h"
#include "SimpleTokenizer.h"
#include "LogCollationAccept.h"
@@ -108,7 +108,7 @@ LogConfig::setup_default_values()
extended2_log_name = ats_strdup("extended2");
extended2_log_header = NULL;
- collation_mode = NO_COLLATION;
+ collation_mode = Log::NO_COLLATION;
collation_host = ats_strdup("none");
collation_port = 0;
collation_host_tagged = false;
@@ -117,7 +117,7 @@ LogConfig::setup_default_values()
collation_retry_sec = 0;
collation_max_send_buffers = 0;
- rolling_enabled = NO_ROLLING;
+ rolling_enabled = Log::NO_ROLLING;
rolling_interval_sec = 86400; // 24 hours
rolling_offset_hr = 0;
rolling_size_mb = 10;
@@ -406,11 +406,18 @@ LogConfig::read_configuration_variables()
// we don't check for valid values of rolling_enabled, rolling_interval_sec,
// rolling_offset_hr, or rolling_size_mb because the LogObject takes care of this
//
- rolling_enabled = (int) REC_ConfigReadInteger("proxy.config.log.rolling_enabled");
rolling_interval_sec = (int) REC_ConfigReadInteger("proxy.config.log.rolling_interval_sec");
rolling_offset_hr = (int) REC_ConfigReadInteger("proxy.config.log.rolling_offset_hr");
rolling_size_mb = (int) REC_ConfigReadInteger("proxy.config.log.rolling_size_mb");
+ val = (int) REC_ConfigReadInteger("proxy.config.log.rolling_enabled");
+ if (LogRollingEnabledIsValid(val)) {
+ rolling_enabled = (Log::RollingEnabledValues)val;
+ } else {
+ Warning("invalid value '%d' for '%s', disabling log rolling", val, "proxy.config.log.rolling_enabled");
+ rolling_enabled = Log::NO_ROLLING;
+ }
+
val = (int) REC_ConfigReadInteger("proxy.config.log.auto_delete_rolled_files");
auto_delete_rolled_files = (val > 0);
@@ -583,11 +590,11 @@ LogConfig::setup_collation(LogConfig * prev_config)
// Set-up the collation status, but only if collation is enabled and
// there are valid entries for the collation host and port.
//
- if (collation_mode<NO_COLLATION || collation_mode>= N_COLLATION_MODES) {
+ if (collation_mode < Log::NO_COLLATION || collation_mode >= Log::N_COLLATION_MODES) {
Note("Invalid value %d for proxy.local.log.collation_mode"
" configuration variable (valid range is from %d to %d)\n"
- "Log collation disabled", collation_mode, NO_COLLATION, N_COLLATION_MODES - 1);
- } else if (collation_mode == NO_COLLATION) {
+ "Log collation disabled", collation_mode, Log::NO_COLLATION, Log::N_COLLATION_MODES - 1);
+ } else if (collation_mode == Log::NO_COLLATION) {
// if the previous configuration had a collation accept, delete it
//
if (prev_config && prev_config->m_log_collation_accept) {
@@ -597,10 +604,10 @@ LogConfig::setup_collation(LogConfig * prev_config)
} else {
if (!collation_port) {
Note("Cannot activate log collation, %d is an invalid collation port", collation_port);
- } else if (collation_mode > COLLATION_HOST && strcmp(collation_host, "none") == 0) {
+ } else if (collation_mode > Log::COLLATION_HOST && strcmp(collation_host, "none") == 0) {
Note("Cannot activate log collation, \"%s\" is an invalid collation host", collation_host);
} else {
- if (collation_mode == COLLATION_HOST) {
+ if (collation_mode == Log::COLLATION_HOST) {
ink_assert(m_log_collation_accept == 0);
@@ -833,12 +840,12 @@ LogConfig::create_predefined_object(const PreDefinedFormatInfo * pdi, size_t num
//
LogObject *obj;
obj = NEW(new LogObject(pdi->format, logfile_dir, obj_fname,
- pdi->filefmt, pdi->header, rolling_enabled,
+ pdi->filefmt, pdi->header, (Log::RollingEnabledValues)rolling_enabled,
collation_preproc_threads, rolling_interval_sec,
rolling_offset_hr, rolling_size_mb));
if (pdi->collatable) {
- if (collation_mode == SEND_STD_FMTS || collation_mode == SEND_STD_AND_NON_XML_CUSTOM_FMTS) {
+ if (collation_mode == Log::SEND_STD_FMTS || collation_mode == Log::SEND_STD_AND_NON_XML_CUSTOM_FMTS) {
LogHost *loghost = NEW(new LogHost(obj->get_full_filename(),
obj->get_signature()));
@@ -2081,13 +2088,17 @@ LogConfig::read_xml_log_config(int from_memory)
char *rollingSizeMb_str = rollingSizeMb.dequeue();
int obj_rolling_size_mb = rollingSizeMb_str ? ink_atoui(rollingSizeMb_str) : rolling_size_mb;
+ if (!LogRollingEnabledIsValid(obj_rolling_enabled)) {
+ Warning("Invalid log rolling value '%d' in log object %s", obj_rolling_enabled, xobj->object_name());
+ }
+
// create the new object
//
LogObject *obj = NEW(new LogObject(fmt, logfile_dir,
filename.dequeue(),
file_type,
header.dequeue(),
- obj_rolling_enabled,
+ (Log::RollingEnabledValues)obj_rolling_enabled,
collation_preproc_threads,
obj_rolling_interval_sec,
obj_rolling_offset_hr,
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/edb3e35b/proxy/logging/LogConfig.h
----------------------------------------------------------------------
diff --git a/proxy/logging/LogConfig.h b/proxy/logging/LogConfig.h
index ab1cb40..1fd4d94 100644
--- a/proxy/logging/LogConfig.h
+++ b/proxy/logging/LogConfig.h
@@ -110,32 +110,6 @@ class LogConfig : public ConfigInfo
public:
- enum CollationMode
- {
- NO_COLLATION = 0,
- COLLATION_HOST,
- SEND_STD_FMTS,
- SEND_NON_XML_CUSTOM_FMTS,
- SEND_STD_AND_NON_XML_CUSTOM_FMTS,
- N_COLLATION_MODES
- };
-
- enum RollingEnabledValues
- {
- NO_ROLLING = 0,
- ROLL_ON_TIME_ONLY,
- ROLL_ON_SIZE_ONLY,
- ROLL_ON_TIME_OR_SIZE,
- ROLL_ON_TIME_AND_SIZE,
- INVALID_ROLLING_VALUE
- };
-
- enum
- {
- // 5 minute minimum rolling interval
- MIN_ROLLING_INTERVAL_SEC = 300
- };
-
LogConfig();
~LogConfig();
@@ -152,7 +126,7 @@ public:
bool space_to_write(int64_t bytes_to_write);
- bool am_collation_host() const { return collation_mode == COLLATION_HOST; }
+ bool am_collation_host() const { return collation_mode == Log::COLLATION_HOST; }
bool space_is_short() { return !space_to_write(max_space_mb_headroom * LOG_MEGABYTE); };
void increment_space_used(int bytes) {
@@ -211,7 +185,7 @@ public:
int collation_preproc_threads;
int collation_retry_sec;
int collation_max_send_buffers;
- int rolling_enabled;
+ Log::RollingEnabledValues rolling_enabled;
int rolling_interval_sec;
int rolling_offset_hr;
int rolling_size_mb;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/edb3e35b/proxy/logging/LogObject.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogObject.cc b/proxy/logging/LogObject.cc
index 8790948..fbc1aa3 100644
--- a/proxy/logging/LogObject.cc
+++ b/proxy/logging/LogObject.cc
@@ -39,6 +39,16 @@
#include "Log.h"
#include "ts/TestBox.h"
+static bool
+should_roll_on_time(Log::RollingEnabledValues roll) {
+ return roll == Log::ROLL_ON_TIME_ONLY || roll == Log::ROLL_ON_TIME_OR_SIZE;
+}
+
+static bool
+should_roll_on_size(Log::RollingEnabledValues roll) {
+ return roll == Log::ROLL_ON_SIZE_ONLY || roll == Log::ROLL_ON_TIME_OR_SIZE;
+}
+
size_t
LogBufferManager::preproc_buffers(LogBufferSink *sink) {
SList(LogBuffer, write_link) q(write_list.popall()), new_q;
@@ -77,7 +87,7 @@ LogBufferManager::preproc_buffers(LogBufferSink *sink) {
LogObject::LogObject(const LogFormat *format, const char *log_dir,
const char *basename, LogFileFormat file_format,
- const char *header, int rolling_enabled,
+ const char *header, Log::RollingEnabledValues rolling_enabled,
int flush_threads, int rolling_interval_sec,
int rolling_offset_hr, int rolling_size_mb,
bool auto_created):
@@ -643,28 +653,28 @@ LogObject::log(LogAccess * lad, const char *text_entry)
void
-LogObject::_setup_rolling(int rolling_enabled, int rolling_interval_sec, int rolling_offset_hr, int rolling_size_mb)
+LogObject::_setup_rolling(Log::RollingEnabledValues rolling_enabled, int rolling_interval_sec, int rolling_offset_hr, int rolling_size_mb)
{
- if (rolling_enabled <= LogConfig::NO_ROLLING || rolling_enabled >= LogConfig::INVALID_ROLLING_VALUE) {
- m_rolling_enabled = LogConfig::NO_ROLLING;
+ if (!LogRollingEnabledIsValid((int)rolling_enabled)) {
+ m_rolling_enabled = Log::NO_ROLLING;
m_rolling_interval_sec = 0;
m_rolling_offset_hr = 0;
m_rolling_size_mb = 0;
- if (rolling_enabled != LogConfig::NO_ROLLING) {
+ if (rolling_enabled != Log::NO_ROLLING) {
Warning("Valid rolling_enabled values are %d to %d, invalid value "
"(%d) specified for %s, rolling will be disabled for this file.",
- LogConfig::NO_ROLLING, LogConfig::INVALID_ROLLING_VALUE - 1, rolling_enabled, m_filename);
+ Log::NO_ROLLING, Log::INVALID_ROLLING_VALUE - 1, rolling_enabled, m_filename);
} else {
Status("Rolling disabled for %s", m_filename);
}
} else {
// do checks for rolling based on time
//
- if (rolling_enabled == LogConfig::ROLL_ON_TIME_ONLY ||
- rolling_enabled == LogConfig::ROLL_ON_TIME_OR_SIZE || rolling_enabled == LogConfig::ROLL_ON_TIME_AND_SIZE) {
- if (rolling_interval_sec < LogConfig::MIN_ROLLING_INTERVAL_SEC) {
+ if (rolling_enabled == Log::ROLL_ON_TIME_ONLY ||
+ rolling_enabled == Log::ROLL_ON_TIME_OR_SIZE || rolling_enabled == Log::ROLL_ON_TIME_AND_SIZE) {
+ if (rolling_interval_sec < Log::MIN_ROLLING_INTERVAL_SEC) {
// check minimum
- m_rolling_interval_sec = LogConfig::MIN_ROLLING_INTERVAL_SEC;
+ m_rolling_interval_sec = Log::MIN_ROLLING_INTERVAL_SEC;
} else if (rolling_interval_sec > 86400) {
// 1 day maximum
m_rolling_interval_sec = 86400;
@@ -692,8 +702,8 @@ LogObject::_setup_rolling(int rolling_enabled, int rolling_interval_sec, int rol
// it will be updated later
}
- if (rolling_enabled == LogConfig::ROLL_ON_SIZE_ONLY ||
- rolling_enabled == LogConfig::ROLL_ON_TIME_OR_SIZE || rolling_enabled == LogConfig::ROLL_ON_TIME_AND_SIZE) {
+ if (rolling_enabled == Log::ROLL_ON_SIZE_ONLY ||
+ rolling_enabled == Log::ROLL_ON_TIME_OR_SIZE || rolling_enabled == Log::ROLL_ON_TIME_AND_SIZE) {
if (rolling_size_mb < 10) {
m_rolling_size_mb = 10;
Note("Rolling size invalid(%d) for %s, setting it to 10 MB", rolling_size_mb, m_filename);
@@ -720,7 +730,7 @@ LogObject::roll_files(long time_now)
if (!time_now)
time_now = LogUtils::timestamp();
- if (m_rolling_enabled != LogConfig::ROLL_ON_SIZE_ONLY) {
+ if (m_rolling_enabled != Log::ROLL_ON_SIZE_ONLY) {
if (m_rolling_interval_sec > 0) {
// We make no assumptions about the current time not having
// changed underneath us. This could happen during daylight
@@ -751,7 +761,7 @@ LogObject::roll_files(long time_now)
}
}
- if (m_rolling_enabled != LogConfig::ROLL_ON_TIME_ONLY) {
+ if (m_rolling_enabled != Log::ROLL_ON_TIME_ONLY) {
if (m_rolling_size_mb) {
// Get file size and check if the file size if greater than the
// configured file size for rolling
@@ -759,12 +769,9 @@ LogObject::roll_files(long time_now)
}
}
- if ((roll_on_time && (m_rolling_enabled == LogConfig::ROLL_ON_TIME_ONLY ||
- m_rolling_enabled == LogConfig::ROLL_ON_TIME_OR_SIZE))
- ||
- (roll_on_size && (m_rolling_enabled == LogConfig::ROLL_ON_SIZE_ONLY ||
- m_rolling_enabled == LogConfig::ROLL_ON_TIME_OR_SIZE))
- || (roll_on_time && roll_on_size && m_rolling_enabled == LogConfig::ROLL_ON_TIME_AND_SIZE)) {
+ if ((roll_on_time && should_roll_on_time(m_rolling_enabled)) ||
+ (roll_on_size && should_roll_on_size(m_rolling_enabled)) ||
+ (roll_on_time && roll_on_size && m_rolling_enabled == Log::ROLL_ON_TIME_AND_SIZE)) {
num_rolled = _roll_files(m_last_roll_time, time_now ? time_now : LogUtils::timestamp());
}
@@ -824,7 +831,7 @@ LogObject::do_filesystem_checks()
-------------------------------------------------------------------------*/
TextLogObject::TextLogObject(const char *name, const char *log_dir,
bool timestamps, const char *header,
- int rolling_enabled, int flush_threads,
+ Log::RollingEnabledValues rolling_enabled, int flush_threads,
int rolling_interval_sec, int rolling_offset_hr,
int rolling_size_mb)
: LogObject(MakeTextLogFormat(), log_dir, name, LOG_FILE_ASCII, header,
@@ -1445,7 +1452,7 @@ MakeTestLogObject(const char * name)
return NEW(new LogObject(&format, tmpdir, name,
LOG_FILE_ASCII /* file_format */, name /* header */,
- 1 /* rolling_enabled */, 1 /* flush_threads */));
+ Log::ROLL_ON_TIME_ONLY /* rolling_enabled */, 1 /* flush_threads */));
}
REGRESSION_TEST(LogObjectManager_Transfer)(RegressionTest * t, int /* atype ATS_UNUSED */, int * pstatus)
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/edb3e35b/proxy/logging/LogObject.h
----------------------------------------------------------------------
diff --git a/proxy/logging/LogObject.h b/proxy/logging/LogObject.h
index 1c67082..f13d2fa 100644
--- a/proxy/logging/LogObject.h
+++ b/proxy/logging/LogObject.h
@@ -99,7 +99,7 @@ public:
LogObject(const LogFormat *format, const char *log_dir, const char *basename,
LogFileFormat file_format, const char *header,
- int rolling_enabled, int flush_threads,
+ Log::RollingEnabledValues rolling_enabled, int flush_threads,
int rolling_interval_sec = 0, int rolling_offset_hr = 0,
int rolling_size_mb = 0, bool auto_created = false)
TS_NONNULL(2 /* format is required */);
@@ -160,7 +160,7 @@ public:
void set_log_file_header(const char *header) { m_logFile->change_header(header); }
- void set_rolling_enabled(int rolling_enabled)
+ void set_rolling_enabled(Log::RollingEnabledValues rolling_enabled)
{
_setup_rolling(rolling_enabled, m_rolling_interval_sec, m_rolling_offset_hr, m_rolling_size_mb);
}
@@ -221,7 +221,7 @@ private:
unsigned int m_flags; // diverse object flags (see above)
uint64_t m_signature; // INK_MD5 signature for object
- int m_rolling_enabled;
+ Log::RollingEnabledValues m_rolling_enabled;
int m_flush_threads; // number of flush threads
int m_rolling_interval_sec; // time interval between rolls
// 0 means no rolling
@@ -237,7 +237,7 @@ private:
LogBufferManager *m_buffer_manager;
void generate_filenames(const char *log_dir, const char *basename, LogFileFormat file_format);
- void _setup_rolling(int rolling_enabled, int rolling_interval_sec, int rolling_offset_hr, int rolling_size_mb);
+ void _setup_rolling(Log::RollingEnabledValues rolling_enabled, int rolling_interval_sec, int rolling_offset_hr, int rolling_size_mb);
int _roll_files(long interval_start, long interval_end);
LogBuffer *_checkout_write(size_t * write_offset, size_t write_size);
@@ -257,7 +257,8 @@ class TextLogObject:public LogObject
public:
inkcoreapi TextLogObject(const char *name, const char *log_dir,
bool timestamps, const char *header,
- int rolling_enabled, int flush_threads,
+ Log::RollingEnabledValues rolling_enabled,
+ int flush_threads,
int rolling_interval_sec,
int rolling_offset_hr,
int rolling_size_mb);
[3/3] git commit: TS-2755: CHANGES
Posted by jp...@apache.org.
TS-2755: CHANGES
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/56e83bda
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/56e83bda
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/56e83bda
Branch: refs/heads/master
Commit: 56e83bda3639292d10cd403fe94254762560dc83
Parents: 6cbdb67
Author: James Peach <jp...@apache.org>
Authored: Mon Apr 28 14:52:19 2014 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Apr 28 14:52:19 2014 -0700
----------------------------------------------------------------------
CHANGES | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/56e83bda/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index b9b6d1d..d4f8c1f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
-*- coding: utf-8 -*-
Changes with Apache Traffic Server 5.0.0
+ *) [TS-2755] Document TSTextLogObjectRollingEnabledSet.
+
*) [TS-2746] Rename session accept layer with a standard convention.
*) [TS-2754] Emit a tcpinfo log on TS_EVENT_HTTP_TXN_CLOSE.
[2/3] git commit: TS-2755: document TSTextLogObjectRollingEnabledSet
Posted by jp...@apache.org.
TS-2755: document TSTextLogObjectRollingEnabledSet
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/6cbdb672
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/6cbdb672
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/6cbdb672
Branch: refs/heads/master
Commit: 6cbdb672bf7ccc0e3852b734dfe1876759756d91
Parents: edb3e35
Author: James Peach <jp...@apache.org>
Authored: Fri Apr 25 14:39:10 2014 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Apr 28 14:45:07 2014 -0700
----------------------------------------------------------------------
doc/conf.py | 1 +
doc/reference/api/TSTextLogObjectCreate.en.rst | 52 +++++++++++++++++++++
doc/reference/api/index.en.rst | 1 +
proxy/InkAPI.cc | 9 +++-
proxy/api/ts/ts.h | 4 +-
5 files changed, 64 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6cbdb672/doc/conf.py
----------------------------------------------------------------------
diff --git a/doc/conf.py b/doc/conf.py
index 81495a0..9b4b66e 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -266,6 +266,7 @@ man_pages = [
('reference/api/TSPluginInit.en', 'TSPluginInit', u'Traffic Server plugin loading and registration', None, u'3ts'),
('reference/api/TSRemap.en', 'TSRemap', u'Traffic Server remap plugin entry points ', None, u'3ts'),
('reference/api/TSTrafficServerVersionGet.en', 'TSTrafficServerVersionGet', u'return Traffic Server version information', None, u'3ts'),
+ ('reference/api/TSTextLogObjectCreate.en', 'TextLogObjectCreate', u'Traffic Server text logging API', None, u'3ts'),
('reference/api/TSUrlCreate.en', 'TSUrlCreate', u'Traffic Server URL object construction API', None, u'3ts'),
('reference/api/TSUrlHostGet.en', 'TSUrlHostGet', u'Traffic Server URL component retrieval API', None, u'3ts'),
('reference/api/TSUrlHostSet.en', 'TSUrlHostSet', u'Traffic Server URL component manipulation API', None, u'3ts'),
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6cbdb672/doc/reference/api/TSTextLogObjectCreate.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/api/TSTextLogObjectCreate.en.rst b/doc/reference/api/TSTextLogObjectCreate.en.rst
new file mode 100644
index 0000000..00eaa82
--- /dev/null
+++ b/doc/reference/api/TSTextLogObjectCreate.en.rst
@@ -0,0 +1,52 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License") you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+.. default-domain:: c
+
+=====================
+TSTextLogObjectCreate
+=====================
+
+Synopsis
+========
+
+`#include <ts/ts.h>`
+
+.. function:: TSReturnCode TSTextLogObjectCreate(const char* filename, int mode, TSTextLogObject * new_log_obj)
+.. function:: TSReturnCode TSTextLogObjectWrite(TSTextLogObject the_object, const char * format, ...)
+.. function:: void TSTextLogObjectFlush(TSTextLogObject the_object)
+.. function:: TSReturnCode TSTextLogObjectDestroy(TSTextLogObject the_object)
+.. function:: void TSTextLogObjectHeaderSet(TSTextLogObject the_object, const char * header)
+.. function:: TSReturnCode TSTextLogObjectRollingEnabledSet(TSTextLogObject the_object, int rolling_enabled)
+.. function:: void TSTextLogObjectRollingIntervalSecSet(TSTextLogObject the_object, int rolling_interval_sec)
+.. function:: void TSTextLogObjectRollingOffsetHrSet(TSTextLogObject the_object, int rolling_offset_hr)
+
+Description
+===========
+
+:func:`TSTextLogObjectRollingEnabledSet` sets the log rolling mode
+for the given object. This API must be used once the object is
+created and before writing into logs. The :arg:`rolling_enabled`
+argument must be a valid :ts:cv:`proxy.config.log.rolling_enabled`
+values. If :func:`TSTextLogObjectRollingEnabledSet` is never called,
+the log object takes it's log rolling mode from the global
+:ts:cv:`proxy.config.log.rolling_enabled` setting.
+
+See also
+========
+
+:manpage:`TSAPI(3ts)`
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6cbdb672/doc/reference/api/index.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/api/index.en.rst b/doc/reference/api/index.en.rst
index 86f931d..b706934 100644
--- a/doc/reference/api/index.en.rst
+++ b/doc/reference/api/index.en.rst
@@ -35,6 +35,7 @@ API Reference
TSMimeHdrFieldValueStringGet.en
TSPluginInit.en
TSRemap.en
+ TSTextLogObjectCreate.en
TSTrafficServerVersionGet.en
TSTypes.en
TSUrlCreate.en
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6cbdb672/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 4bb2e3f..38e143c 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -6888,12 +6888,17 @@ TSTextLogObjectHeaderSet(TSTextLogObject the_object, const char *header)
((TextLogObject *) the_object)->set_log_file_header(header);
}
-void
+TSReturnCode
TSTextLogObjectRollingEnabledSet(TSTextLogObject the_object, int rolling_enabled)
{
sdk_assert(sdk_sanity_check_iocore_structure(the_object) == TS_SUCCESS);
- ((TextLogObject *) the_object)->set_rolling_enabled((Log::RollingEnabledValues)rolling_enabled);
+ if (LogRollingEnabledIsValid(rolling_enabled)) {
+ ((TextLogObject *) the_object)->set_rolling_enabled((Log::RollingEnabledValues)rolling_enabled);
+ return TS_SUCCESS;
+ }
+
+ return TS_ERROR;
}
void
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6cbdb672/proxy/api/ts/ts.h
----------------------------------------------------------------------
diff --git a/proxy/api/ts/ts.h b/proxy/api/ts/ts.h
index 26dabc5..5e88314 100644
--- a/proxy/api/ts/ts.h
+++ b/proxy/api/ts/ts.h
@@ -2106,8 +2106,10 @@ extern "C"
/**
Enable/disable rolling.
+ @param rolling_enabled a valid proxy.config.log.rolling_enabled value.
+
*/
- tsapi void TSTextLogObjectRollingEnabledSet(TSTextLogObject the_object, int rolling_enabled);
+ tsapi TSReturnCode TSTextLogObjectRollingEnabledSet(TSTextLogObject the_object, int rolling_enabled);
/**
Set the rolling interval.