LoggerNDC
LoggerNDC
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.
Methods summary
Modifier and Type | Method |
---|---|
public static | clear ( ) |
public static array | get ( ) |
public static integer | getDepth ( ) |
public static string | pop ( ) |
public static string | peek ( ) |
public static | push ( string message ) |
public static | remove ( ) |
public static | setMaxDepth ( integer maxDepth ) |
Methods in detail
-
clear
public static clear ( )Clear any nested diagnostic information if any. This method is useful in cases where the same thread can be potentially used over and over in different unrelated contexts.This method is equivalent to calling the setMaxDepth() method with a zero maxDepth</var> argument.
-
get
array public static get ( )Never use this method directly, use the LoggerLoggingEvent::getNDC() method instead.return
array -
getDepth
integer public static getDepth ( )Get the current nesting depth of this diagnostic context.see
n2n\log4php\setMaxDepth()return
integer -
pop
string public static pop ( )Clients should call this method before leaving a diagnostic context.The returned value is the value that was pushed last. If no context is available, then the empty string "" is returned.
return
string -
peek
string public static peek ( )Looks at the last diagnostic context at the top of this NDC without removing it.The returned value is the value that was pushed last. If no context is available, then the empty string "" is returned.
return
string -
push
public static push ( string message )Push new diagnostic context information for the current thread.The contents of the message</var> parameter is determined solely by the client.
param
string message The new diagnostic context information. -
remove
public static remove ( )Remove the diagnostic context for this thread. -
setMaxDepth
public static setMaxDepth ( integer maxDepth )Set maximum depth of this diagnostic context. If the current depth is smaller or equal to maxDepth, then no action is taken. <p>This method is a convenient alternative to multiple pop() calls. Moreover, it is often the case that at the end of complex call sequences, the depth of the NDC is unpredictable. The setMaxDepth() method circumvents this problem.param
integer maxDepthsee
n2n\log4php\getDepth()