Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
Source Code for Apache Log4j Core Implementation
Apache Log4j Core Implementation
provides the functional components of the logging system. Users are free to
create their own plugins and include them in the logging configuration.
Apache Log4j Core is a required module to use Apache Log4j.
Bytecode (Java 8) for Apache Log4j Core Implementation is provided in a separate JAR file like log4j-core-2.14.1.jar.
Source Code files for Apache Log4j API are provided in both binary packge like apache-log4j-2.14.1-bin.zip and source package like apache-log4j-2.14.1-src.zip. You can download them at Apache Log4j Website.
You can also browse Source Code files for Apache Log4j Core Implementation 2.14.1 below.
✍: FYIcenter.com
⏎ org/apache/logging/log4j/core/layout/SerializedLayout.java
/* * 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. */ package org.apache.logging.log4j.core.layout; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.OutputStream; import org.apache.logging.log4j.core.Layout; import org.apache.logging.log4j.core.LogEvent; import org.apache.logging.log4j.core.config.Node; import org.apache.logging.log4j.core.config.plugins.Plugin; import org.apache.logging.log4j.core.config.plugins.PluginFactory; /** * Formats a {@link LogEvent} in its Java serialized form. * * @deprecated Java Serialization has inherent security weaknesses, see https://www.owasp.org/index.php/Deserialization_of_untrusted_data . * Using this layout is no longer recommended. An alternative layout containing the same information is * {@link JsonLayout} when configured with properties="true". Deprecated since 2.9. */ @Deprecated @Plugin(name = "SerializedLayout", category = Node.CATEGORY, elementType = Layout.ELEMENT_TYPE, printObject = true) public final class SerializedLayout extends AbstractLayout<LogEvent> { private static byte[] serializedHeader; static { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { new ObjectOutputStream(baos).close(); serializedHeader = baos.toByteArray(); } catch (final Exception ex) { LOGGER.error("Unable to generate Object stream header", ex); } } private SerializedLayout() { super(null, null, null); LOGGER.warn("SerializedLayout is deprecated due to the inherent security weakness in Java Serialization, see https://www.owasp.org/index.php/Deserialization_of_untrusted_data Consider using another layout, e.g. JsonLayout"); } /** * Formats a {@link org.apache.logging.log4j.core.LogEvent} as a serialized byte array of the LogEvent object. * * @param event The LogEvent. * @return the formatted LogEvent. */ @Override public byte[] toByteArray(final LogEvent event) { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (final ObjectOutputStream oos = new PrivateObjectOutputStream(baos)) { oos.writeObject(event); oos.reset(); } catch (final IOException ioe) { LOGGER.error("Serialization of LogEvent failed.", ioe); } return baos.toByteArray(); } /** * Returns the LogEvent. * * @param event The Logging Event. * @return The LogEvent. */ @Override public LogEvent toSerializable(final LogEvent event) { return event; } /** * Creates a SerializedLayout. * @return A SerializedLayout. */ @Deprecated @PluginFactory public static SerializedLayout createLayout() { return new SerializedLayout(); } @Override public byte[] getHeader() { return serializedHeader; } /** * SerializedLayout returns a binary stream. * @return The content type. */ @Override public String getContentType() { return "application/octet-stream"; } /** * The stream header will be written in the Manager so skip it here. */ private class PrivateObjectOutputStream extends ObjectOutputStream { public PrivateObjectOutputStream(final OutputStream os) throws IOException { super(os); } @Override protected void writeStreamHeader() { // do nothing } } }
⏎ org/apache/logging/log4j/core/layout/SerializedLayout.java
Or download all of them as a single archive file:
File name: log4j-core-2.14.1-sources.jar File size: 1281358 bytes Release date: 2021-03-06 Download
⇒ Source Code for Apache Log4j JDK Logging Adapter
⇐ Source Code for Apache Log4j API
2015-11-03, 65409👍, 0💬
Popular Posts:
What Is wstx-asl-3.2.8.jar? wstx-asl-3.2.8.jar is JAR file for the ASL component of Woodstox 3.2.8. ...
The JSR 105 XML Digital Signature 1.0.1 FCS implementation provides an API and implementation that a...
XOM™ is a new XML object model. It is an open source (LGPL), tree-based API for processing XML with ...
Apache Log4j 1.2 Bridge allows applications coded to use Log4j 1.2 API to use Log4j 2 instead. Bytec...
JDK 11 jdk.crypto.cryptoki.jmod is the JMOD file for JDK 11 Crypto Cryptoki module. JDK 11 Crypto KI...