diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/snmp/doc/src/snmp.xml | 80 | ||||
-rw-r--r-- | lib/snmp/doc/src/snmpa.xml | 8 | ||||
-rw-r--r-- | lib/snmp/doc/src/snmpm.xml | 12 | ||||
-rw-r--r-- | lib/snmp/src/agent/snmpa.erl | 25 | ||||
-rw-r--r-- | lib/snmp/src/app/snmp.erl | 16 | ||||
-rw-r--r-- | lib/snmp/src/manager/snmpm.erl | 21 | ||||
-rw-r--r-- | lib/snmp/src/misc/snmp_log.erl | 17 | ||||
-rw-r--r-- | lib/snmp/test/snmp_log_test.erl | 10 |
8 files changed, 100 insertions, 89 deletions
diff --git a/lib/snmp/doc/src/snmp.xml b/lib/snmp/doc/src/snmp.xml index 3e6610891f..97b479385c 100644 --- a/lib/snmp/doc/src/snmp.xml +++ b/lib/snmp/doc/src/snmp.xml @@ -341,8 +341,9 @@ <func> <name>log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile) -> ok | {error, Reason}</name> - <name>log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start) -> ok | {error, Reason}</name> - <name>log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start, Stop) -> ok | {error, Reason}</name> + <name>log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block | Start) -> ok | {error, Reason}</name> + <name>log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start, Block | Stop) -> ok | {error, Reason}</name> + <name>log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start, Stop, Block) -> ok | {error, Reason}</name> <fsummary>Convert an Audit Trail Log to text format</fsummary> <type> <v>LogDir = string()</v> @@ -352,53 +353,56 @@ <v>LogName = string()</v> <v>LogFile = string()</v> <v>Start = Stop = null | datetime() | {local_time,datetime()} | {universal_time,datetime()} </v> + <v>Block = boolean()</v> <v>Reason = term()</v> </type> <desc> - <p>Converts an Audit Trail Log to a readable text file, where - each item has a trailing TAB character, and any TAB - character in the body of an item has been replaced by ESC - TAB. - </p> + <p>Converts an Audit Trail Log to a readable text file, where + each item has a trailing TAB character, and any TAB + character in the body of an item has been replaced by ESC + TAB. </p> <p>The function can be used on a running system, or by copying - the entire log directory and calling this function. SNMP - must be running in order to provide MIB information. - </p> + the entire log directory and calling this function. SNMP + must be running in order to provide MIB information. </p> <p><c>LogDir</c> is the name of the directory where the audit - trail log is stored. - <c>Mibs</c> is a list of Mibs to be used. The function uses - the information in the Mibs to convert for example object - identifiers to their symbolic name. - <c>OutFile</c> is the name of the generated text-file. - <c>LogName</c> is the name of the log, - <c>LogFile</c> is the name of the log file. - <c>Start</c> is the start (first) date and time from which - log events will be converted and - <c>Stop</c> is the stop (last) date and time to which log - events will be converted. - </p> - <p>The format of an audit trail log text item is as follows: - </p> - <p><c>Tag Addr - Community [TimeStamp] Vsn</c><br></br> - <c>PDU</c></p> - <p>where <c>Tag</c> is <c>request</c>, <c>response</c>, - <c>report</c>, <c>trap</c> or <c>inform</c>; Addr is - <c>IP:Port</c> (or comma space separated list of such); - <c>Community</c> is the community parameter (SNMP version - v1 and v2), or <c>SecLevel:"AuthEngineID":"UserName"</c> - (SNMP v3); <c>TimeStamp</c> is a date and time stamp, - and <c>Vsn</c> is the SNMP version. <c>PDU</c> is a textual - version of the protocol data unit. There is a new line - between <c>Vsn</c> and <c>PDU</c>.</p> - + trail log is stored. + <c>Mibs</c> is a list of Mibs to be used. The function uses + the information in the Mibs to convert for example object + identifiers to their symbolic name. + <c>OutFile</c> is the name of the generated text-file. + <c>LogName</c> is the name of the log, + <c>LogFile</c> is the name of the log file. + <c>Start</c> is the start (first) date and time from which + log events will be converted and + <c>Stop</c> is the stop (last) date and time to which log + events will be converted. + The <c>Block</c> argument indicates if the log should be blocked + during conversion. This could be usefull when converting large + logs (when otherwise the log could wrap during conversion). + Defaults to <c>true</c>. + </p> + <p>The format of an audit trail log text item is as follows: </p> + <p><c>Tag Addr - Community [TimeStamp] Vsn</c><br></br> + <c>PDU</c></p> + <p>where <c>Tag</c> is <c>request</c>, <c>response</c>, + <c>report</c>, <c>trap</c> or <c>inform</c>; Addr is + <c>IP:Port</c> (or comma space separated list of such); + <c>Community</c> is the community parameter (SNMP version + v1 and v2), or <c>SecLevel:"AuthEngineID":"UserName"</c> + (SNMP v3); <c>TimeStamp</c> is a date and time stamp, + and <c>Vsn</c> is the SNMP version. <c>PDU</c> is a textual + version of the protocol data unit. There is a new line + between <c>Vsn</c> and <c>PDU</c>.</p> + <marker id="log_to_io"></marker> </desc> </func> <func> <name>log_to_io(LogDir, Mibs, LogName, LogFile) -> ok | {error, Reason}</name> - <name>log_to_io(LogDir, Mibs, LogName, LogFile, Start) -> ok | {error, Reason}</name> - <name>log_to_io(LogDir, Mibs, LogName, LogFile, Start, Stop) -> ok | {error, Reason}</name> + <name>log_to_io(LogDir, Mibs, LogName, LogFile, Block | Start) -> ok | {error, Reason}</name> + <name>log_to_io(LogDir, Mibs, LogName, LogFile, Start, Block | Stop) -> ok | {error, Reason}</name> + <name>log_to_io(LogDir, Mibs, LogName, LogFile, Start, Stop, Block) -> ok | {error, Reason}</name> <fsummary>Convert an Audit Trail Log to text format</fsummary> <type> <v>LogDir = string()</v> diff --git a/lib/snmp/doc/src/snmpa.xml b/lib/snmp/doc/src/snmpa.xml index 29e8869401..cc8681e5c8 100644 --- a/lib/snmp/doc/src/snmpa.xml +++ b/lib/snmp/doc/src/snmpa.xml @@ -570,7 +570,7 @@ notification_delivery_info() = #snmpa_notification_delivery_info{} <v>LogDir = string()</v> <v>Mibs = [MibName]</v> <v>MibName = string()</v> - <v>Block = block()</v> + <v>Block = boolean()</v> <v>OutFile = string()</v> <v>LogName = string()</v> <v>LogFile = string()</v> @@ -587,7 +587,7 @@ notification_delivery_info() = #snmpa_notification_delivery_info{} <p>The <c>Block</c> option indicates if the log should be blocked during conversion. This could be usefull when converting large logs (when otherwise the log could wrap during conversion). - Defaults to <c>false</c>. </p> + Defaults to <c>true</c>. </p> <p>See <seealso marker="snmp#log_to_txt">snmp:log_to_txt</seealso> for more info.</p> @@ -609,7 +609,7 @@ notification_delivery_info() = #snmpa_notification_delivery_info{} <v>LogDir = string()</v> <v>Mibs = [MibName]</v> <v>MibName = string()</v> - <v>Block = block()</v> + <v>Block = boolean()</v> <v>LogName = string()</v> <v>LogFile = string()</v> <v>Start = Stop = null | calendar:datetime() | {local_time, calendar:datetime()} | {universal_time, calendar:datetime()} </v> @@ -625,7 +625,7 @@ notification_delivery_info() = #snmpa_notification_delivery_info{} <p>The <c>Block</c> option indicates if the log should be blocked during conversion. This could be usefull when converting large logs (when otherwise the log could wrap during conversion). - Defaults to <c>false</c>. </p> + Defaults to <c>true</c>. </p> See <seealso marker="snmp#log_to_io">snmp:log_to_io</seealso> for more info.</p> diff --git a/lib/snmp/doc/src/snmpm.xml b/lib/snmp/doc/src/snmpm.xml index f7b7e6220e..a0a1b5716d 100644 --- a/lib/snmp/doc/src/snmpm.xml +++ b/lib/snmp/doc/src/snmpm.xml @@ -1223,7 +1223,7 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1 <v>LogDir = string()</v> <v>Mibs = [MibName]</v> <v>MibName = string()</v> - <v>Block = block()</v> + <v>Block = boolean()</v> <v>OutFile = string()</v> <v>LogName = string()</v> <v>LogFile = string()</v> @@ -1237,10 +1237,10 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1 <c>OutFile</c> defaults to "./snmpm_log.txt". <c>LogName</c> defaults to "snmpm_log". <c>LogFile</c> defaults to "snmpm.log". - <p>The <c>Block</c> option indicates if the log should be blocked + <p>The <c>Block</c> argument indicates if the log should be blocked during conversion. This could be usefull when converting large logs (when otherwise the log could wrap during conversion). - Defaults to <c>false</c>. </p> + Defaults to <c>true</c>. </p> See <seealso marker="snmp#log_to_txt">snmp:log_to_txt</seealso> for more info.</p> @@ -1263,7 +1263,7 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1 <v>LogDir = string()</v> <v>Mibs = [MibName]</v> <v>MibName = string()</v> - <v>Block = block()</v> + <v>Block = boolean()</v> <v>LogName = string()</v> <v>LogFile = string()</v> <v>Start = Stop = null | calendar:datetime() | {local_time, calendar:datetime()} | {universal_time, calendar:datetime()} </v> @@ -1276,6 +1276,10 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1 prints it on stdio. <c>LogName</c> defaults to "snmpm_log". <c>LogFile</c> defaults to "snmpm.log". + <p>The <c>Block</c> argument indicates if the log should be blocked + during conversion. This could be usefull when converting large + logs (when otherwise the log could wrap during conversion). + Defaults to <c>true</c>. </p> See <seealso marker="snmp#log_to_io">snmp:log_to_io</seealso> for more info.</p> diff --git a/lib/snmp/src/agent/snmpa.erl b/lib/snmp/src/agent/snmpa.erl index 3804966e61..aea63effe6 100644 --- a/lib/snmp/src/agent/snmpa.erl +++ b/lib/snmp/src/agent/snmpa.erl @@ -129,7 +129,8 @@ -include("snmpa_internal.hrl"). -include_lib("snmp/include/snmp_types.hrl"). % type of me needed. --define(DISCO_EXTRA_INFO, undefined). +-define(DISCO_EXTRA_INFO, undefined). +-define(ATL_BLOCK_DEFAULT, true). %%----------------------------------------------------------------- @@ -893,7 +894,7 @@ log_to_txt(LogDir, Block) snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, OutFile = "snmpa_log.txt", LogName = ?audit_trail_log_name, LogFile = ?audit_trail_log_file, @@ -915,7 +916,7 @@ log_to_txt(LogDir, Mibs, Block) LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs, OutFile) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, LogName = ?audit_trail_log_name, LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block). @@ -937,7 +938,7 @@ log_to_txt(LogDir, Mibs, OutFile, Block) LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs, OutFile, LogName) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block). @@ -959,7 +960,7 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, Block) LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block). -spec log_to_txt(LogDir :: snmp:dir(), @@ -981,7 +982,7 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block) when ((Block =:= true) orelse (Block =:= false)) -> snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start). -spec log_to_txt(LogDir :: snmp:dir(), @@ -1006,7 +1007,7 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start) snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start); log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start, Stop) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop). -spec log_to_txt(LogDir :: snmp:dir(), @@ -1033,7 +1034,7 @@ log_to_io(LogDir, Block) LogFile = ?audit_trail_log_file, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block); log_to_io(LogDir, Mibs) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, LogName = ?audit_trail_log_name, LogFile = ?audit_trail_log_file, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block). @@ -1044,7 +1045,7 @@ log_to_io(LogDir, Mibs, Block) LogFile = ?audit_trail_log_file, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block); log_to_io(LogDir, Mibs, LogName) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, LogFile = ?audit_trail_log_file, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block). @@ -1053,21 +1054,21 @@ log_to_io(LogDir, Mibs, LogName, Block) LogFile = ?audit_trail_log_file, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block); log_to_io(LogDir, Mibs, LogName, LogFile) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block). log_to_io(LogDir, Mibs, LogName, LogFile, Block) when ((Block =:= true) orelse (Block =:= false)) -> snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block); log_to_io(LogDir, Mibs, LogName, LogFile, Start) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start). log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start) when ((Block =:= true) orelse (Block =:= false)) -> snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start); log_to_io(LogDir, Mibs, LogName, LogFile, Start, Stop) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop). log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop) -> diff --git a/lib/snmp/src/app/snmp.erl b/lib/snmp/src/app/snmp.erl index 967afa0e08..16ccee9612 100644 --- a/lib/snmp/src/app/snmp.erl +++ b/lib/snmp/src/app/snmp.erl @@ -150,8 +150,8 @@ {get_agent_caps, 0, eventually}]). --define(APPLICATION, snmp). - +-define(APPLICATION, snmp). +-define(ATL_BLOCK_DEFAULT, true). %%----------------------------------------------------------------- @@ -859,7 +859,7 @@ read_mib(FileName) -> %%%----------------------------------------------------------------- log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, Start = null, Stop = null, log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop). @@ -870,7 +870,7 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block) Stop = null, log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop); log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, Stop = null, log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop). @@ -879,7 +879,7 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start) Stop = null, log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop); log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start, Stop) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop). log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop) -> @@ -888,7 +888,7 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop) -> log_to_io(LogDir, Mibs, LogName, LogFile) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, Start = null, Stop = null, log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop). @@ -899,7 +899,7 @@ log_to_io(LogDir, Mibs, LogName, LogFile, Block) Stop = null, log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop); log_to_io(LogDir, Mibs, LogName, LogFile, Start) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, Stop = null, log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop). @@ -908,7 +908,7 @@ log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start) Stop = null, log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop); log_to_io(LogDir, Mibs, LogName, LogFile, Start, Stop) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop). log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop) -> diff --git a/lib/snmp/src/manager/snmpm.erl b/lib/snmp/src/manager/snmpm.erl index a749153ece..379abe933e 100644 --- a/lib/snmp/src/manager/snmpm.erl +++ b/lib/snmp/src/manager/snmpm.erl @@ -118,6 +118,7 @@ -include("snmp_verbosity.hrl"). -define(DEFAULT_AGENT_PORT, 161). +-define(ATL_BLOCK_DEFAULT, true). %% This function is called when the snmp application @@ -782,7 +783,7 @@ log_to_txt(LogDir, Block) LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, OutFile = "snmpm_log.txt", LogName = ?audit_trail_log_name, LogFile = ?audit_trail_log_file, @@ -804,7 +805,7 @@ log_to_txt(LogDir, Mibs, Block) LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs, OutFile) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, LogName = ?audit_trail_log_name, LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block). @@ -826,7 +827,7 @@ log_to_txt(LogDir, Mibs, OutFile, Block) LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs, OutFile, LogName) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block). @@ -848,7 +849,7 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, Block) LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block). -spec log_to_txt(LogDir :: snmp:dir(), @@ -870,7 +871,7 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block) when ((Block =:= true) orelse (Block =:= false)) -> snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start). -spec log_to_txt(LogDir :: snmp:dir(), @@ -894,7 +895,7 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start) when ((Block =:= true) orelse (Block =:= false)) -> snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start); log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start, Stop) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop). -spec log_to_txt(LogDir :: snmp:dir(), @@ -931,7 +932,7 @@ log_to_io(LogDir, Mibs, Block) LogFile = ?audit_trail_log_file, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block); log_to_io(LogDir, Mibs, LogName) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, LogFile = ?audit_trail_log_file, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block). @@ -940,21 +941,21 @@ log_to_io(LogDir, Mibs, LogName, Block) LogFile = ?audit_trail_log_file, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block); log_to_io(LogDir, Mibs, LogName, LogFile) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block). log_to_io(LogDir, Mibs, LogName, LogFile, Block) when ((Block =:= true) orelse (Block =:= false)) -> snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block); log_to_io(LogDir, Mibs, LogName, LogFile, Start) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start). log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start) when ((Block =:= true) orelse (Block =:= false)) -> snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start); log_to_io(LogDir, Mibs, LogName, LogFile, Start, Stop) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop). log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop) -> diff --git a/lib/snmp/src/misc/snmp_log.erl b/lib/snmp/src/misc/snmp_log.erl index de03c97281..ce3af66f88 100644 --- a/lib/snmp/src/misc/snmp_log.erl +++ b/lib/snmp/src/misc/snmp_log.erl @@ -52,8 +52,9 @@ -define(VMODULE,"LOG"). -include("snmp_verbosity.hrl"). --define(LOG_FORMAT, internal). --define(LOG_TYPE, wrap). +-define(LOG_FORMAT, internal). +-define(LOG_TYPE, wrap). +-define(BLOCK_DEFAULT, true). -record(snmp_log, {id, seqno}). @@ -400,7 +401,7 @@ do_change_size(Log, NewSize) -> %% <BACKWARD-COMPAT> log_to_txt(Log, FileName, Dir, Mibs, TextFile) -> - log_to_txt(Log, false, FileName, Dir, Mibs, TextFile). + log_to_txt(Log, ?BLOCK_DEFAULT, FileName, Dir, Mibs, TextFile). %% </BACKWARD-COMPAT> log_to_txt(Log, Block, FileName, Dir, Mibs, TextFile) @@ -408,7 +409,7 @@ log_to_txt(Log, Block, FileName, Dir, Mibs, TextFile) log_to_txt(Log, Block, FileName, Dir, Mibs, TextFile, null, null); %% <BACKWARD-COMPAT> log_to_txt(Log, FileName, Dir, Mibs, TextFile, Start) -> - log_to_txt(Log, false, FileName, Dir, Mibs, TextFile, Start, null). + log_to_txt(Log, ?BLOCK_DEFAULT, FileName, Dir, Mibs, TextFile, Start, null). %% </BACKWARD-COMPAT> log_to_txt(Log, Block, FileName, Dir, Mibs, TextFile, Start) @@ -416,7 +417,7 @@ log_to_txt(Log, Block, FileName, Dir, Mibs, TextFile, Start) log_to_txt(Log, Block, FileName, Dir, Mibs, TextFile, Start, null); %% <BACKWARD-COMPAT> log_to_txt(Log, FileName, Dir, Mibs, TextFile, Start, Stop) -> - log_to_txt(Log, false, FileName, Dir, Mibs, TextFile, Start, Stop). + log_to_txt(Log, ?BLOCK_DEFAULT, FileName, Dir, Mibs, TextFile, Start, Stop). %% </BACKWARD-COMPAT> log_to_txt(Log, Block, FileName, Dir, Mibs, TextFile, Start, Stop) @@ -443,7 +444,7 @@ log_to_txt(Log, Block, FileName, Dir, Mibs, TextFile, Start, Stop) %% <BACKWARD-COMPAT> log_to_io(Log, FileName, Dir, Mibs) -> - log_to_io(Log, false, FileName, Dir, Mibs, null, null). + log_to_io(Log, ?BLOCK_DEFAULT, FileName, Dir, Mibs, null, null). %% </BACKWARD-COMPAT> log_to_io(Log, Block, FileName, Dir, Mibs) @@ -451,7 +452,7 @@ log_to_io(Log, Block, FileName, Dir, Mibs) log_to_io(Log, Block, FileName, Dir, Mibs, null, null); %% <BACKWARD-COMPAT> log_to_io(Log, FileName, Dir, Mibs, Start) -> - log_to_io(Log, false, FileName, Dir, Mibs, Start, null). + log_to_io(Log, ?BLOCK_DEFAULT, FileName, Dir, Mibs, Start, null). %% </BACKWARD-COMPAT> log_to_io(Log, Block, FileName, Dir, Mibs, Start) @@ -459,7 +460,7 @@ log_to_io(Log, Block, FileName, Dir, Mibs, Start) log_to_io(Log, Block, FileName, Dir, Mibs, Start, null); %% <BACKWARD-COMPAT> log_to_io(Log, FileName, Dir, Mibs, Start, Stop) -> - log_to_io(Log, false, FileName, Dir, Mibs, Start, Stop). + log_to_io(Log, ?BLOCK_DEFAULT, FileName, Dir, Mibs, Start, Stop). %% </BACKWARD-COMPAT> log_to_io(Log, Block, FileName, Dir, Mibs, Start, Stop) diff --git a/lib/snmp/test/snmp_log_test.erl b/lib/snmp/test/snmp_log_test.erl index cbd843b8fe..fb7285110f 100644 --- a/lib/snmp/test/snmp_log_test.erl +++ b/lib/snmp/test/snmp_log_test.erl @@ -331,7 +331,7 @@ log_to_io1(doc) -> "Log to io from the same process that opened " log_to_io1(Config) when is_list(Config) -> p(log_to_io1), put(sname,l2i1), - put(verbosity,trace), + put(verbosity,debug), ?DBG("log_to_io1 -> start", []), Dir = ?config(log_dir, Config), Name = "snmp_test_l2i1", @@ -386,7 +386,7 @@ log_to_io2(Config) when is_list(Config) -> process_flag(trap_exit, true), p(log_to_io2), put(sname, l2i2), - put(verbosity,trace), + put(verbosity,debug), ?DBG("log_to_io2 -> start", []), Dir = ?config(log_dir, Config), Name = "snmp_test_l2i2", @@ -445,7 +445,7 @@ log_to_txt1(suite) -> []; log_to_txt1(Config) when is_list(Config) -> p(log_to_txt1), put(sname,l2t1), - put(verbosity,trace), + put(verbosity,debug), ?DBG("log_to_txt1 -> start", []), Name = "snmp_test_l2t1", @@ -463,7 +463,7 @@ log_to_txt2(suite) -> []; log_to_txt2(Config) when is_list(Config) -> p(log_to_txt2), put(sname,l2t2), - put(verbosity,trace), + put(verbosity,debug), ?DBG("log_to_txt2 -> start", []), Name = "snmp_test_l2t2", @@ -600,7 +600,7 @@ log_to_txt3(Config) when is_list(Config) -> process_flag(trap_exit, true), p(log_to_txt3), put(sname,l2t3), - put(verbosity,trace), + put(verbosity,debug), ?DBG("log_to_txt3 -> start", []), Dir = ?config(log_dir, Config), Name = "snmp_test_l2t3", |