[
https://issues.apache.org/jira/browse/TS-306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682177#comment-14682177
]
ASF GitHub Bot commented on TS-306:
-----------------------------------
Github user danobi commented on a diff in the pull request:
https://github.com/apache/trafficserver/pull/274#discussion_r36776891
--- Diff: lib/ts/BaseLogFile.cc ---
@@ -0,0 +1,571 @@
+/** @file
+
+ Base class for log files implementation
+
+ @section license License
+
+ 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.
+ */
+
+#include "BaseLogFile.h"
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * This is the most common way BaseLogFiles are created.
+ */
+BaseLogFile::BaseLogFile(const char *name)
+ : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false),
m_has_signature(false), m_signature(0), m_is_init(false)
+{
+ m_fp = NULL;
+ m_start_time = time(0);
+ m_end_time = 0L;
+ m_bytes_written = 0;
+ m_meta_info = NULL;
+
+ log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n",
m_name, this);
+}
+
+/*
+ * This consturctor creates a BaseLogFile based on a given name.
+ * Similar to above constructor, but is overloaded with the object
signature
+ */
+BaseLogFile::BaseLogFile(const char *name, uint64_t sig)
+ : m_name(ats_strdup(name)), m_hostname(NULL), m_is_regfile(false),
m_has_signature(true), m_signature(sig), m_is_init(false)
+{
+ m_fp = NULL;
+ m_start_time = time(0);
+ m_end_time = 0L;
+ m_bytes_written = 0;
+ m_meta_info = NULL;
+
+ log_log_trace("exiting BaseLogFile constructor, m_name=%s, this=%p\n",
m_name, this);
+}
+
+/*
+ * This copy constructor creates a BaseLogFile based on a given copy.
+ */
+BaseLogFile::BaseLogFile(const BaseLogFile ©)
+ : m_fp(NULL), m_start_time(copy.m_start_time), m_end_time(0L),
m_bytes_written(0), m_name(ats_strdup(copy.m_name)),
+ m_hostname(ats_strdup(m_hostname)), m_is_regfile(false),
m_has_signature(copy.m_has_signature), m_signature(copy.m_signature),
--- End diff --
Typo, whoops. Was supposed to be `m_hostname(ats_strdup(copy.m_hostname))`
> enable log rotation for diags.log
> ---------------------------------
>
> Key: TS-306
> URL: https://issues.apache.org/jira/browse/TS-306
> Project: Traffic Server
> Issue Type: Improvement
> Components: Logging
> Reporter: Miles Libbey
> Assignee: Daniel Xu
> Labels: newbie
> Fix For: 6.1.0
>
>
> (from yahoo bug 913896)
> Original description
> by Leif Hedstrom 3 years ago at 2006-12-04 12:42
> There might be reasons why this file might get filled up, e.g. libraries used
> by plugins producing output on STDOUT/STDERR. A few suggestions have been
> made, to somehow rotate traffic.out. One possible solution (suggested by
> Ryan) is to use cronolog (http://cronolog.org/), which seems like a fine idea.
>
>
> Comment 1
> by Joseph Rothrock 2 years ago at 2007-10-17 09:13:24
> Maybe consider rolling diags.log as well. -Feature enhancement.
>
> Comment 2
> by Kevin Dalley 13 months ago at 2009-03-04 15:32:18
> When traffic.out gets filled up, error.log stops filing up, even though
> rotation is turned on. This is
> counter-intuitive. Rotation does not control traffic.out, but a large
> traffic.out will stop error.log from being
> written.
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)