rt/emul/compact/src/main/java/java/util/logging/LogRecord.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Sat, 07 Sep 2013 13:56:22 +0200
changeset 1260 fe3567c7b522
parent 1259 d257b7a37635
permissions -rw-r--r--
Re-implementation of the JDK APIs to fit into the browser
jaroslav@1258
     1
/*
jaroslav@1258
     2
 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
jaroslav@1258
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jaroslav@1258
     4
 *
jaroslav@1258
     5
 * This code is free software; you can redistribute it and/or modify it
jaroslav@1258
     6
 * under the terms of the GNU General Public License version 2 only, as
jaroslav@1258
     7
 * published by the Free Software Foundation.  Oracle designates this
jaroslav@1258
     8
 * particular file as subject to the "Classpath" exception as provided
jaroslav@1258
     9
 * by Oracle in the LICENSE file that accompanied this code.
jaroslav@1258
    10
 *
jaroslav@1258
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
jaroslav@1258
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jaroslav@1258
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
jaroslav@1258
    14
 * version 2 for more details (a copy is included in the LICENSE file that
jaroslav@1258
    15
 * accompanied this code).
jaroslav@1258
    16
 *
jaroslav@1258
    17
 * You should have received a copy of the GNU General Public License version
jaroslav@1258
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
jaroslav@1258
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jaroslav@1258
    20
 *
jaroslav@1258
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jaroslav@1258
    22
 * or visit www.oracle.com if you need additional information or have any
jaroslav@1258
    23
 * questions.
jaroslav@1258
    24
 */
jaroslav@1258
    25
jaroslav@1258
    26
package java.util.logging;
jaroslav@1258
    27
import java.io.*;
jaroslav@1258
    28
jaroslav@1258
    29
/**
jaroslav@1258
    30
 * LogRecord objects are used to pass logging requests between
jaroslav@1258
    31
 * the logging framework and individual log Handlers.
jaroslav@1258
    32
 * <p>
jaroslav@1258
    33
 * When a LogRecord is passed into the logging framework it
jaroslav@1258
    34
 * logically belongs to the framework and should no longer be
jaroslav@1258
    35
 * used or updated by the client application.
jaroslav@1258
    36
 * <p>
jaroslav@1258
    37
 * Note that if the client application has not specified an
jaroslav@1258
    38
 * explicit source method name and source class name, then the
jaroslav@1258
    39
 * LogRecord class will infer them automatically when they are
jaroslav@1258
    40
 * first accessed (due to a call on getSourceMethodName or
jaroslav@1258
    41
 * getSourceClassName) by analyzing the call stack.  Therefore,
jaroslav@1258
    42
 * if a logging Handler wants to pass off a LogRecord to another
jaroslav@1258
    43
 * thread, or to transmit it over RMI, and if it wishes to subsequently
jaroslav@1258
    44
 * obtain method name or class name information it should call
jaroslav@1258
    45
 * one of getSourceClassName or getSourceMethodName to force
jaroslav@1258
    46
 * the values to be filled in.
jaroslav@1258
    47
 * <p>
jaroslav@1258
    48
 * <b> Serialization notes:</b>
jaroslav@1258
    49
 * <ul>
jaroslav@1258
    50
 * <li>The LogRecord class is serializable.
jaroslav@1258
    51
 *
jaroslav@1258
    52
 * <li> Because objects in the parameters array may not be serializable,
jaroslav@1258
    53
 * during serialization all objects in the parameters array are
jaroslav@1258
    54
 * written as the corresponding Strings (using Object.toString).
jaroslav@1258
    55
 *
jaroslav@1258
    56
 * <li> The ResourceBundle is not transmitted as part of the serialized
jaroslav@1258
    57
 * form, but the resource bundle name is, and the recipient object's
jaroslav@1258
    58
 * readObject method will attempt to locate a suitable resource bundle.
jaroslav@1258
    59
 *
jaroslav@1258
    60
 * </ul>
jaroslav@1258
    61
 *
jaroslav@1258
    62
 * @since 1.4
jaroslav@1258
    63
 */
jaroslav@1258
    64
jaroslav@1258
    65
public class LogRecord implements java.io.Serializable {
jaroslav@1260
    66
    private static long globalSequenceNumber = 0;
jaroslav@1258
    67
jaroslav@1258
    68
    /**
jaroslav@1258
    69
     * The default value of threadID will be the current thread's
jaroslav@1258
    70
     * thread id, for ease of correlation, unless it is greater than
jaroslav@1258
    71
     * MIN_SEQUENTIAL_THREAD_ID, in which case we try harder to keep
jaroslav@1258
    72
     * our promise to keep threadIDs unique by avoiding collisions due
jaroslav@1258
    73
     * to 32-bit wraparound.  Unfortunately, LogRecord.getThreadID()
jaroslav@1258
    74
     * returns int, while Thread.getId() returns long.
jaroslav@1258
    75
     */
jaroslav@1258
    76
    private static final int MIN_SEQUENTIAL_THREAD_ID = Integer.MAX_VALUE / 2;
jaroslav@1258
    77
jaroslav@1258
    78
    /**
jaroslav@1258
    79
     * @serial Logging message level
jaroslav@1258
    80
     */
jaroslav@1258
    81
    private Level level;
jaroslav@1258
    82
jaroslav@1258
    83
    /**
jaroslav@1258
    84
     * @serial Sequence number
jaroslav@1258
    85
     */
jaroslav@1258
    86
    private long sequenceNumber;
jaroslav@1258
    87
jaroslav@1258
    88
    /**
jaroslav@1258
    89
     * @serial Class that issued logging call
jaroslav@1258
    90
     */
jaroslav@1258
    91
    private String sourceClassName;
jaroslav@1258
    92
jaroslav@1258
    93
    /**
jaroslav@1258
    94
     * @serial Method that issued logging call
jaroslav@1258
    95
     */
jaroslav@1258
    96
    private String sourceMethodName;
jaroslav@1258
    97
jaroslav@1258
    98
    /**
jaroslav@1258
    99
     * @serial Non-localized raw message text
jaroslav@1258
   100
     */
jaroslav@1258
   101
    private String message;
jaroslav@1258
   102
jaroslav@1258
   103
    /**
jaroslav@1258
   104
     * @serial Thread ID for thread that issued logging call.
jaroslav@1258
   105
     */
jaroslav@1258
   106
    private int threadID;
jaroslav@1258
   107
jaroslav@1258
   108
    /**
jaroslav@1258
   109
     * @serial Event time in milliseconds since 1970
jaroslav@1258
   110
     */
jaroslav@1258
   111
    private long millis;
jaroslav@1258
   112
jaroslav@1258
   113
    /**
jaroslav@1258
   114
     * @serial The Throwable (if any) associated with log message
jaroslav@1258
   115
     */
jaroslav@1258
   116
    private Throwable thrown;
jaroslav@1258
   117
jaroslav@1258
   118
    /**
jaroslav@1258
   119
     * @serial Name of the source Logger.
jaroslav@1258
   120
     */
jaroslav@1258
   121
    private String loggerName;
jaroslav@1258
   122
jaroslav@1258
   123
    /**
jaroslav@1258
   124
     * @serial Resource bundle name to localized log message.
jaroslav@1258
   125
     */
jaroslav@1258
   126
    private String resourceBundleName;
jaroslav@1258
   127
jaroslav@1258
   128
    private transient boolean needToInferCaller;
jaroslav@1258
   129
    private transient Object parameters[];
jaroslav@1258
   130
jaroslav@1258
   131
    /**
jaroslav@1258
   132
     * Returns the default value for a new LogRecord's threadID.
jaroslav@1258
   133
     */
jaroslav@1258
   134
    private int defaultThreadID() {
jaroslav@1260
   135
        return 0;
jaroslav@1258
   136
    }
jaroslav@1258
   137
jaroslav@1258
   138
    /**
jaroslav@1258
   139
     * Construct a LogRecord with the given level and message values.
jaroslav@1258
   140
     * <p>
jaroslav@1258
   141
     * The sequence property will be initialized with a new unique value.
jaroslav@1258
   142
     * These sequence values are allocated in increasing order within a VM.
jaroslav@1258
   143
     * <p>
jaroslav@1258
   144
     * The millis property will be initialized to the current time.
jaroslav@1258
   145
     * <p>
jaroslav@1258
   146
     * The thread ID property will be initialized with a unique ID for
jaroslav@1258
   147
     * the current thread.
jaroslav@1258
   148
     * <p>
jaroslav@1258
   149
     * All other properties will be initialized to "null".
jaroslav@1258
   150
     *
jaroslav@1258
   151
     * @param level  a logging level value
jaroslav@1258
   152
     * @param msg  the raw non-localized logging message (may be null)
jaroslav@1258
   153
     */
jaroslav@1258
   154
    public LogRecord(Level level, String msg) {
jaroslav@1258
   155
        // Make sure level isn't null, by calling random method.
jaroslav@1258
   156
        level.getClass();
jaroslav@1258
   157
        this.level = level;
jaroslav@1258
   158
        message = msg;
jaroslav@1258
   159
        // Assign a thread ID and a unique sequence number.
jaroslav@1260
   160
        sequenceNumber = globalSequenceNumber++;
jaroslav@1258
   161
        threadID = defaultThreadID();
jaroslav@1258
   162
        millis = System.currentTimeMillis();
jaroslav@1258
   163
        needToInferCaller = true;
jaroslav@1258
   164
   }
jaroslav@1258
   165
jaroslav@1258
   166
    /**
jaroslav@1258
   167
     * Get the source Logger's name.
jaroslav@1258
   168
     *
jaroslav@1258
   169
     * @return source logger name (may be null)
jaroslav@1258
   170
     */
jaroslav@1258
   171
    public String getLoggerName() {
jaroslav@1258
   172
        return loggerName;
jaroslav@1258
   173
    }
jaroslav@1258
   174
jaroslav@1258
   175
    /**
jaroslav@1258
   176
     * Set the source Logger's name.
jaroslav@1258
   177
     *
jaroslav@1258
   178
     * @param name   the source logger name (may be null)
jaroslav@1258
   179
     */
jaroslav@1258
   180
    public void setLoggerName(String name) {
jaroslav@1258
   181
        loggerName = name;
jaroslav@1258
   182
    }
jaroslav@1258
   183
jaroslav@1258
   184
    /**
jaroslav@1258
   185
     * Get the localization resource bundle
jaroslav@1258
   186
     * <p>
jaroslav@1258
   187
     * This is the ResourceBundle that should be used to localize
jaroslav@1258
   188
     * the message string before formatting it.  The result may
jaroslav@1258
   189
     * be null if the message is not localizable, or if no suitable
jaroslav@1258
   190
     * ResourceBundle is available.
jaroslav@1258
   191
     */
jaroslav@1260
   192
//    public ResourceBundle getResourceBundle() {
jaroslav@1260
   193
//        return resourceBundle;
jaroslav@1260
   194
//    }
jaroslav@1258
   195
jaroslav@1258
   196
    /**
jaroslav@1258
   197
     * Set the localization resource bundle.
jaroslav@1258
   198
     *
jaroslav@1258
   199
     * @param bundle  localization bundle (may be null)
jaroslav@1258
   200
     */
jaroslav@1260
   201
//    public void setResourceBundle(ResourceBundle bundle) {
jaroslav@1260
   202
//        resourceBundle = bundle;
jaroslav@1260
   203
//    }
jaroslav@1258
   204
jaroslav@1258
   205
    /**
jaroslav@1258
   206
     * Get the localization resource bundle name
jaroslav@1258
   207
     * <p>
jaroslav@1258
   208
     * This is the name for the ResourceBundle that should be
jaroslav@1258
   209
     * used to localize the message string before formatting it.
jaroslav@1258
   210
     * The result may be null if the message is not localizable.
jaroslav@1258
   211
     */
jaroslav@1258
   212
    public String getResourceBundleName() {
jaroslav@1258
   213
        return resourceBundleName;
jaroslav@1258
   214
    }
jaroslav@1258
   215
jaroslav@1258
   216
    /**
jaroslav@1258
   217
     * Set the localization resource bundle name.
jaroslav@1258
   218
     *
jaroslav@1258
   219
     * @param name  localization bundle name (may be null)
jaroslav@1258
   220
     */
jaroslav@1258
   221
    public void setResourceBundleName(String name) {
jaroslav@1258
   222
        resourceBundleName = name;
jaroslav@1258
   223
    }
jaroslav@1258
   224
jaroslav@1258
   225
    /**
jaroslav@1258
   226
     * Get the logging message level, for example Level.SEVERE.
jaroslav@1258
   227
     * @return the logging message level
jaroslav@1258
   228
     */
jaroslav@1258
   229
    public Level getLevel() {
jaroslav@1258
   230
        return level;
jaroslav@1258
   231
    }
jaroslav@1258
   232
jaroslav@1258
   233
    /**
jaroslav@1258
   234
     * Set the logging message level, for example Level.SEVERE.
jaroslav@1258
   235
     * @param level the logging message level
jaroslav@1258
   236
     */
jaroslav@1258
   237
    public void setLevel(Level level) {
jaroslav@1258
   238
        if (level == null) {
jaroslav@1258
   239
            throw new NullPointerException();
jaroslav@1258
   240
        }
jaroslav@1258
   241
        this.level = level;
jaroslav@1258
   242
    }
jaroslav@1258
   243
jaroslav@1258
   244
    /**
jaroslav@1258
   245
     * Get the sequence number.
jaroslav@1258
   246
     * <p>
jaroslav@1258
   247
     * Sequence numbers are normally assigned in the LogRecord
jaroslav@1258
   248
     * constructor, which assigns unique sequence numbers to
jaroslav@1258
   249
     * each new LogRecord in increasing order.
jaroslav@1258
   250
     * @return the sequence number
jaroslav@1258
   251
     */
jaroslav@1258
   252
    public long getSequenceNumber() {
jaroslav@1258
   253
        return sequenceNumber;
jaroslav@1258
   254
    }
jaroslav@1258
   255
jaroslav@1258
   256
    /**
jaroslav@1258
   257
     * Set the sequence number.
jaroslav@1258
   258
     * <p>
jaroslav@1258
   259
     * Sequence numbers are normally assigned in the LogRecord constructor,
jaroslav@1258
   260
     * so it should not normally be necessary to use this method.
jaroslav@1258
   261
     */
jaroslav@1258
   262
    public void setSequenceNumber(long seq) {
jaroslav@1258
   263
        sequenceNumber = seq;
jaroslav@1258
   264
    }
jaroslav@1258
   265
jaroslav@1258
   266
    /**
jaroslav@1258
   267
     * Get the  name of the class that (allegedly) issued the logging request.
jaroslav@1258
   268
     * <p>
jaroslav@1258
   269
     * Note that this sourceClassName is not verified and may be spoofed.
jaroslav@1258
   270
     * This information may either have been provided as part of the
jaroslav@1258
   271
     * logging call, or it may have been inferred automatically by the
jaroslav@1258
   272
     * logging framework.  In the latter case, the information may only
jaroslav@1258
   273
     * be approximate and may in fact describe an earlier call on the
jaroslav@1258
   274
     * stack frame.
jaroslav@1258
   275
     * <p>
jaroslav@1258
   276
     * May be null if no information could be obtained.
jaroslav@1258
   277
     *
jaroslav@1258
   278
     * @return the source class name
jaroslav@1258
   279
     */
jaroslav@1258
   280
    public String getSourceClassName() {
jaroslav@1258
   281
        return sourceClassName;
jaroslav@1258
   282
    }
jaroslav@1258
   283
jaroslav@1258
   284
    /**
jaroslav@1258
   285
     * Set the name of the class that (allegedly) issued the logging request.
jaroslav@1258
   286
     *
jaroslav@1258
   287
     * @param sourceClassName the source class name (may be null)
jaroslav@1258
   288
     */
jaroslav@1258
   289
    public void setSourceClassName(String sourceClassName) {
jaroslav@1258
   290
        this.sourceClassName = sourceClassName;
jaroslav@1258
   291
        needToInferCaller = false;
jaroslav@1258
   292
    }
jaroslav@1258
   293
jaroslav@1258
   294
    /**
jaroslav@1258
   295
     * Get the  name of the method that (allegedly) issued the logging request.
jaroslav@1258
   296
     * <p>
jaroslav@1258
   297
     * Note that this sourceMethodName is not verified and may be spoofed.
jaroslav@1258
   298
     * This information may either have been provided as part of the
jaroslav@1258
   299
     * logging call, or it may have been inferred automatically by the
jaroslav@1258
   300
     * logging framework.  In the latter case, the information may only
jaroslav@1258
   301
     * be approximate and may in fact describe an earlier call on the
jaroslav@1258
   302
     * stack frame.
jaroslav@1258
   303
     * <p>
jaroslav@1258
   304
     * May be null if no information could be obtained.
jaroslav@1258
   305
     *
jaroslav@1258
   306
     * @return the source method name
jaroslav@1258
   307
     */
jaroslav@1258
   308
    public String getSourceMethodName() {
jaroslav@1258
   309
        return sourceMethodName;
jaroslav@1258
   310
    }
jaroslav@1258
   311
jaroslav@1258
   312
    /**
jaroslav@1258
   313
     * Set the name of the method that (allegedly) issued the logging request.
jaroslav@1258
   314
     *
jaroslav@1258
   315
     * @param sourceMethodName the source method name (may be null)
jaroslav@1258
   316
     */
jaroslav@1258
   317
    public void setSourceMethodName(String sourceMethodName) {
jaroslav@1258
   318
        this.sourceMethodName = sourceMethodName;
jaroslav@1258
   319
        needToInferCaller = false;
jaroslav@1258
   320
    }
jaroslav@1258
   321
jaroslav@1258
   322
    /**
jaroslav@1258
   323
     * Get the "raw" log message, before localization or formatting.
jaroslav@1258
   324
     * <p>
jaroslav@1258
   325
     * May be null, which is equivalent to the empty string "".
jaroslav@1258
   326
     * <p>
jaroslav@1258
   327
     * This message may be either the final text or a localization key.
jaroslav@1258
   328
     * <p>
jaroslav@1258
   329
     * During formatting, if the source logger has a localization
jaroslav@1258
   330
     * ResourceBundle and if that ResourceBundle has an entry for
jaroslav@1258
   331
     * this message string, then the message string is replaced
jaroslav@1258
   332
     * with the localized value.
jaroslav@1258
   333
     *
jaroslav@1258
   334
     * @return the raw message string
jaroslav@1258
   335
     */
jaroslav@1258
   336
    public String getMessage() {
jaroslav@1258
   337
        return message;
jaroslav@1258
   338
    }
jaroslav@1258
   339
jaroslav@1258
   340
    /**
jaroslav@1258
   341
     * Set the "raw" log message, before localization or formatting.
jaroslav@1258
   342
     *
jaroslav@1258
   343
     * @param message the raw message string (may be null)
jaroslav@1258
   344
     */
jaroslav@1258
   345
    public void setMessage(String message) {
jaroslav@1258
   346
        this.message = message;
jaroslav@1258
   347
    }
jaroslav@1258
   348
jaroslav@1258
   349
    /**
jaroslav@1258
   350
     * Get the parameters to the log message.
jaroslav@1258
   351
     *
jaroslav@1258
   352
     * @return the log message parameters.  May be null if
jaroslav@1258
   353
     *                  there are no parameters.
jaroslav@1258
   354
     */
jaroslav@1258
   355
    public Object[] getParameters() {
jaroslav@1258
   356
        return parameters;
jaroslav@1258
   357
    }
jaroslav@1258
   358
jaroslav@1258
   359
    /**
jaroslav@1258
   360
     * Set the parameters to the log message.
jaroslav@1258
   361
     *
jaroslav@1258
   362
     * @param parameters the log message parameters. (may be null)
jaroslav@1258
   363
     */
jaroslav@1258
   364
    public void setParameters(Object parameters[]) {
jaroslav@1258
   365
        this.parameters = parameters;
jaroslav@1258
   366
    }
jaroslav@1258
   367
jaroslav@1258
   368
    /**
jaroslav@1258
   369
     * Get an identifier for the thread where the message originated.
jaroslav@1258
   370
     * <p>
jaroslav@1258
   371
     * This is a thread identifier within the Java VM and may or
jaroslav@1258
   372
     * may not map to any operating system ID.
jaroslav@1258
   373
     *
jaroslav@1258
   374
     * @return thread ID
jaroslav@1258
   375
     */
jaroslav@1258
   376
    public int getThreadID() {
jaroslav@1258
   377
        return threadID;
jaroslav@1258
   378
    }
jaroslav@1258
   379
jaroslav@1258
   380
    /**
jaroslav@1258
   381
     * Set an identifier for the thread where the message originated.
jaroslav@1258
   382
     * @param threadID  the thread ID
jaroslav@1258
   383
     */
jaroslav@1258
   384
    public void setThreadID(int threadID) {
jaroslav@1258
   385
        this.threadID = threadID;
jaroslav@1258
   386
    }
jaroslav@1258
   387
jaroslav@1258
   388
    /**
jaroslav@1258
   389
     * Get event time in milliseconds since 1970.
jaroslav@1258
   390
     *
jaroslav@1258
   391
     * @return event time in millis since 1970
jaroslav@1258
   392
     */
jaroslav@1258
   393
    public long getMillis() {
jaroslav@1258
   394
        return millis;
jaroslav@1258
   395
    }
jaroslav@1258
   396
jaroslav@1258
   397
    /**
jaroslav@1258
   398
     * Set event time.
jaroslav@1258
   399
     *
jaroslav@1258
   400
     * @param millis event time in millis since 1970
jaroslav@1258
   401
     */
jaroslav@1258
   402
    public void setMillis(long millis) {
jaroslav@1258
   403
        this.millis = millis;
jaroslav@1258
   404
    }
jaroslav@1258
   405
jaroslav@1258
   406
    /**
jaroslav@1258
   407
     * Get any throwable associated with the log record.
jaroslav@1258
   408
     * <p>
jaroslav@1258
   409
     * If the event involved an exception, this will be the
jaroslav@1258
   410
     * exception object. Otherwise null.
jaroslav@1258
   411
     *
jaroslav@1258
   412
     * @return a throwable
jaroslav@1258
   413
     */
jaroslav@1258
   414
    public Throwable getThrown() {
jaroslav@1258
   415
        return thrown;
jaroslav@1258
   416
    }
jaroslav@1258
   417
jaroslav@1258
   418
    /**
jaroslav@1258
   419
     * Set a throwable associated with the log event.
jaroslav@1258
   420
     *
jaroslav@1258
   421
     * @param thrown  a throwable (may be null)
jaroslav@1258
   422
     */
jaroslav@1258
   423
    public void setThrown(Throwable thrown) {
jaroslav@1258
   424
        this.thrown = thrown;
jaroslav@1258
   425
    }
jaroslav@1258
   426
jaroslav@1258
   427
    private static final long serialVersionUID = 5372048053134512534L;
jaroslav@1258
   428
jaroslav@1258
   429
    /**
jaroslav@1258
   430
     * @serialData Default fields, followed by a two byte version number
jaroslav@1258
   431
     * (major byte, followed by minor byte), followed by information on
jaroslav@1258
   432
     * the log record parameter array.  If there is no parameter array,
jaroslav@1258
   433
     * then -1 is written.  If there is a parameter array (possible of zero
jaroslav@1258
   434
     * length) then the array length is written as an integer, followed
jaroslav@1258
   435
     * by String values for each parameter.  If a parameter is null, then
jaroslav@1258
   436
     * a null String is written.  Otherwise the output of Object.toString()
jaroslav@1258
   437
     * is written.
jaroslav@1258
   438
     */
jaroslav@1258
   439
    private void writeObject(ObjectOutputStream out) throws IOException {
jaroslav@1258
   440
        // We have to call defaultWriteObject first.
jaroslav@1258
   441
        out.defaultWriteObject();
jaroslav@1258
   442
jaroslav@1258
   443
        // Write our version number.
jaroslav@1258
   444
        out.writeByte(1);
jaroslav@1258
   445
        out.writeByte(0);
jaroslav@1258
   446
        if (parameters == null) {
jaroslav@1258
   447
            out.writeInt(-1);
jaroslav@1258
   448
            return;
jaroslav@1258
   449
        }
jaroslav@1258
   450
        out.writeInt(parameters.length);
jaroslav@1258
   451
        // Write string values for the parameters.
jaroslav@1258
   452
        for (int i = 0; i < parameters.length; i++) {
jaroslav@1258
   453
            if (parameters[i] == null) {
jaroslav@1258
   454
                out.writeObject(null);
jaroslav@1258
   455
            } else {
jaroslav@1258
   456
                out.writeObject(parameters[i].toString());
jaroslav@1258
   457
            }
jaroslav@1258
   458
        }
jaroslav@1258
   459
    }
jaroslav@1258
   460
jaroslav@1258
   461
jaroslav@1258
   462
    private boolean isLoggerImplFrame(String cname) {
jaroslav@1258
   463
        // the log record could be created for a platform logger
jaroslav@1258
   464
        return (cname.equals("java.util.logging.Logger") ||
jaroslav@1258
   465
                cname.startsWith("java.util.logging.LoggingProxyImpl") ||
jaroslav@1258
   466
                cname.startsWith("sun.util.logging."));
jaroslav@1258
   467
    }
jaroslav@1258
   468
}