Skip to content

Commit 7d97bbd

Browse files
committed
introduce PersistenceContextLogging
1 parent a6601ba commit 7d97bbd

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright Red Hat Inc. and Hibernate Authors
4+
*/
5+
package org.hibernate.internal;
6+
7+
import org.hibernate.Internal;
8+
import org.hibernate.internal.log.SubSystemLogging;
9+
10+
import org.jboss.logging.BasicLogger;
11+
import org.jboss.logging.Logger;
12+
import org.jboss.logging.annotations.LogMessage;
13+
import org.jboss.logging.annotations.Message;
14+
import org.jboss.logging.annotations.MessageLogger;
15+
import org.jboss.logging.annotations.ValidIdRange;
16+
17+
import java.lang.invoke.MethodHandles;
18+
19+
import static org.jboss.logging.Logger.Level.DEBUG;
20+
import static org.jboss.logging.Logger.Level.TRACE;
21+
import static org.jboss.logging.Logger.Level.WARN;
22+
23+
/**
24+
* Sub-system logging related to PersistenceContext runtime events
25+
*/
26+
@SubSystemLogging(
27+
name = PersistenceContextLogging.NAME,
28+
description = "Logging related to persistence context operations and serialization"
29+
)
30+
@MessageLogger(projectCode = "HHH")
31+
@ValidIdRange(min = 90031001, max = 90032000)
32+
@Internal
33+
public interface PersistenceContextLogging extends BasicLogger {
34+
String NAME = SubSystemLogging.BASE + ".persistenceContext";
35+
36+
PersistenceContextLogging PERSISTENCE_CONTEXT_LOGGER = Logger.getMessageLogger( MethodHandles.lookup(), PersistenceContextLogging.class, NAME );
37+
38+
@LogMessage(level = TRACE)
39+
@Message("Setting proxy identifier: %s")
40+
void settingProxyIdentifier(Object id);
41+
42+
@LogMessage(level = WARN)
43+
@Message("Narrowing proxy to %s - this operation breaks ==")
44+
void narrowingProxy(Class<?> concreteProxyClass);
45+
46+
@LogMessage(level = TRACE)
47+
@Message("Serializing persistence context")
48+
void serializingPersistenceContext();
49+
50+
@LogMessage(level = TRACE)
51+
@Message("Deserializing persistence context")
52+
void deserializingPersistenceContext();
53+
54+
@LogMessage(level = TRACE)
55+
@Message("Encountered pruned proxy")
56+
void encounteredPrunedProxy();
57+
58+
@LogMessage(level = TRACE)
59+
@Message("Starting serialization of [%s] %s entries")
60+
void startingSerializationOfEntries(int count, String keysName);
61+
62+
@LogMessage(level = TRACE)
63+
@Message("Starting deserialization of [%s] %s entries")
64+
void startingDeserializationOfEntries(int count, String keysName);
65+
66+
// Merge and reachability logs (DEBUG/TRACE variants matching existing usage)
67+
@LogMessage(level = TRACE)
68+
@Message("Detached object being merged (corresponding with a managed entity) has a collection that [%s] the detached child")
69+
void detachedManagedContainsChild(String containsOrNot);
70+
71+
@LogMessage(level = DEBUG)
72+
@Message("Detached proxy being merged has a collection that [%s] the managed child")
73+
void detachedProxyContainsManagedChild(String containsOrNot);
74+
75+
@LogMessage(level = DEBUG)
76+
@Message("Detached proxy being merged has a collection that [%s] the detached child being merged")
77+
void detachedProxyContainsDetachedChild(String containsOrNot);
78+
79+
@LogMessage(level = DEBUG)
80+
@Message("A detached object being merged (corresponding to a parent in parentsByChild) has an indexed collection that [%s] the detached child being merged. ")
81+
void detachedParentIndexedContainsDetachedChild(String containsOrNot);
82+
83+
@LogMessage(level = DEBUG)
84+
@Message("A detached object being merged (corresponding to a managed entity) has an indexed collection that [%s] the detached child being merged. ")
85+
void detachedManagedIndexedContainsDetachedChild(String containsOrNot);
86+
}

0 commit comments

Comments
 (0)