1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache license, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the license for the specific language governing permissions and
15 * limitations under the license.
16 */
17 package org.apache.log4j.spi;
18
19 /**
20 The internal representation of caller location information.
21
22 @since 0.8.3
23 */
24 public class LocationInfo implements java.io.Serializable {
25
26 private final StackTraceElement element;
27
28 public String fullInfo;
29
30 public LocationInfo(StackTraceElement element) {
31 this.element = element;
32 }
33
34 /**
35 When location information is not available the constant
36 <code>NA</code> is returned. Current value of this string
37 constant is <b>?</b>. */
38 public final static String NA = "?";
39
40 static final long serialVersionUID = -1325822038990805636L;
41
42
43 /**
44 Return the fully qualified class name of the caller making the
45 logging request.
46 */
47 public
48 String getClassName() {
49 return element.getClassName();
50 }
51
52 /**
53 Return the file name of the caller.
54 */
55 public
56 String getFileName() {
57 return element.getFileName();
58 }
59
60 /**
61 Returns the line number of the caller.
62 */
63 public
64 String getLineNumber() {
65 return Integer.toString(element.getLineNumber());
66 }
67
68 /**
69 Returns the method name of the caller.
70 */
71 public
72 String getMethodName() {
73 return element.getMethodName();
74 }
75 }