Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add new configuration options for logging. #1880 #2264

Merged
merged 3 commits into from Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
90 changes: 76 additions & 14 deletions src/Agent/NewRelic/Agent/Core/Config/Configuration.cs
@@ -1,6 +1,3 @@
// Copyright 2020 New Relic, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
tippmar-nr marked this conversation as resolved.
Show resolved Hide resolved

// ------------------------------------------------------------------------------
// <auto-generated>
// Generated by Xsd2Code. Version 3.6.0.0
Expand Down Expand Up @@ -1284,10 +1281,11 @@ public virtual configurationApplication Clone()
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:newrelic-config")]
public partial class configurationLog
{
private bool enabledField;

private string levelField;

private bool enabledField;

private string directoryField;

private string fileNameField;
Expand All @@ -1296,15 +1294,24 @@ public partial class configurationLog

private bool auditLogField;

private configurationLogLogRollingStrategy logRollingStrategyField;

private int maxLogFileSizeBytesField;

private int maxLogFilesField;

/// <summary>
/// configurationLog class constructor
/// </summary>
public configurationLog()
{
this.enabledField = true;
this.levelField = "info";
this.enabledField = true;
this.consoleField = false;
this.auditLogField = false;
this.logRollingStrategyField = configurationLogLogRollingStrategy.size;
this.maxLogFileSizeBytesField = 52428800;
this.maxLogFilesField = 4;
}

[System.Xml.Serialization.XmlAttributeAttribute()]
Expand All @@ -1321,6 +1328,20 @@ public string level
}
}

[System.Xml.Serialization.XmlAttributeAttribute()]
[System.ComponentModel.DefaultValueAttribute(true)]
public bool enabled
{
get
{
return this.enabledField;
}
set
{
this.enabledField = value;
}
}

[System.Xml.Serialization.XmlAttributeAttribute()]
public string directory
{
Expand Down Expand Up @@ -1360,32 +1381,60 @@ public bool console
this.consoleField = value;
}
}

[System.Xml.Serialization.XmlAttributeAttribute()]
[System.ComponentModel.DefaultValueAttribute(true)]
public bool enabled
[System.ComponentModel.DefaultValueAttribute(false)]
public bool auditLog
{
get
{
return this.enabledField;
return this.auditLogField;
}
set
{
this.enabledField = value;
this.auditLogField = value;
}
}

[System.Xml.Serialization.XmlAttributeAttribute()]
[System.ComponentModel.DefaultValueAttribute(false)]
public bool auditLog
[System.ComponentModel.DefaultValueAttribute(configurationLogLogRollingStrategy.size)]
public configurationLogLogRollingStrategy logRollingStrategy
{
get
{
return this.auditLogField;
return this.logRollingStrategyField;
}
set
{
this.auditLogField = value;
this.logRollingStrategyField = value;
}
}

[System.Xml.Serialization.XmlAttributeAttribute()]
[System.ComponentModel.DefaultValueAttribute(52428800)]
public int maxLogFileSizeBytes
{
get
{
return this.maxLogFileSizeBytesField;
}
set
{
this.maxLogFileSizeBytesField = value;
}
}

[System.Xml.Serialization.XmlAttributeAttribute()]
[System.ComponentModel.DefaultValueAttribute(4)]
public int maxLogFiles
{
get
{
return this.maxLogFilesField;
}
set
{
this.maxLogFilesField = value;
}
}

Expand All @@ -1400,6 +1449,19 @@ public virtual configurationLog Clone()
#endregion
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("Xsd2Code", "3.6.0.20097")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:newrelic-config")]
public enum configurationLogLogRollingStrategy
{

/// <remarks/>
size,

/// <remarks/>
day,
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("Xsd2Code", "3.6.0.20097")]
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
Expand Down
44 changes: 43 additions & 1 deletion src/Agent/NewRelic/Agent/Core/Config/Configuration.xsd
Expand Up @@ -320,7 +320,7 @@
</xs:documentation>
</xs:annotation>
</xs:attribute>

<xs:attribute name="directory" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
Expand Down Expand Up @@ -355,6 +355,48 @@
</xs:annotation>
</xs:attribute>

<xs:attribute name="logRollingStrategy" default="size" use="optional" >
<xs:annotation>
<xs:documentation>
The strategy to use for rolling over the log file. Default is size.
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="size">
<xs:annotation>
<xs:documentation>
The log file will be rolled over when it reaches the size specified in maxLogFileSizeBytes.
tippmar-nr marked this conversation as resolved.
Show resolved Hide resolved
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="day">
<xs:annotation>
<xs:documentation>
The log file will be rolled over once each day.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:attribute>

<xs:attribute name="maxLogFileSizeBytes" type="xs:int" default="52428800" use="optional">
<xs:annotation>
<xs:documentation>
The maximum size of the log file in bytes before it is rolled over. Default is 50MB. If this is set to 0, no size limit will be enforced. Only used if logRollingStrategy is set to "size".
</xs:documentation>
</xs:annotation>
</xs:attribute>

<xs:attribute name="maxLogFiles" type="xs:int" default="4" use="optional">
<xs:annotation>
<xs:documentation>
The maximum number of log files to keep. Defaults to 4. If this is set to 0, then all log files will be kept.
</xs:documentation>
</xs:annotation>
</xs:attribute>

</xs:complexType>
</xs:element>

Expand Down