Skip to content

Commit c81ae5a

Browse files
--
1 parent 5febe65 commit c81ae5a

File tree

5 files changed

+32
-32
lines changed

5 files changed

+32
-32
lines changed

logback-amqp-appender/src/main/java/ch/qos/logback/amqp/AmqpAppender.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ public final void start ()
174174
this.routingKeyLayout.start ();
175175
this.publisher =
176176
new AmqpPublisher (
177-
this.host, this.port, this.virtualHost, this.username, this.password,
178-
this.callbacks, this.buffer);
177+
this.host, this.port, this.virtualHost, this.username, this.password, this.callbacks, this.buffer);
179178
this.publisher.start ();
180179
super.start ();
181180
this.postStart ();
@@ -214,15 +213,15 @@ protected final void append (final ILoggingEvent originalEvent)
214213
}
215214
}
216215

217-
protected void preStart ()
218-
{}
219-
220216
protected void postStart ()
221217
{}
222218

223219
protected void postStop ()
224220
{}
225221

222+
protected void preStart ()
223+
{}
224+
226225
protected void preStop ()
227226
{}
228227

@@ -234,6 +233,7 @@ private final Serializable prepare (final ILoggingEvent originalEvent)
234233
return (newEvent);
235234
}
236235

236+
protected final Callbacks callbacks;
237237
private final LinkedBlockingDeque<AmqpMessage> buffer;
238238
private final PatternLayout exchangeLayout;
239239
private String host;
@@ -245,7 +245,6 @@ private final Serializable prepare (final ILoggingEvent originalEvent)
245245
private Serializer serializer;
246246
private String username;
247247
private String virtualHost;
248-
protected final Callbacks callbacks;
249248

250249
public static final String defaultExchangeKeyPattern = "logback%nopex";
251250
public static final String defaultRoutingKeyPattern = "%level%nopex";

logback-amqp-common/src/main/java/ch/qos/logback/amqp/AmqpConsumer.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,16 @@ private final boolean declare ()
132132
}
133133
{
134134
this.callbacks.handleLogEvent (
135-
Level.INFO, null, "amqp consumer binding the queue `%s` to exchange `%s` with routing key `%s`", this.queue1, this.exchange, this.routingKey);
135+
Level.INFO, null, "amqp consumer binding the queue `%s` to exchange `%s` with routing key `%s`",
136+
this.queue1, this.exchange, this.routingKey);
136137
try {
137138
channel.queueBind (this.queue1, this.exchange, this.routingKey, null);
138139
} catch (final Throwable exception) {
139-
this.callbacks.handleException (
140-
exception,
141-
"amqp consumer encountered an error while binding the queue `%s` to exchange `%s` with routing key `%s`; aborting!",
142-
this.queue1, this.exchange, this.routingKey);
140+
this.callbacks
141+
.handleException (
142+
exception,
143+
"amqp consumer encountered an error while binding the queue `%s` to exchange `%s` with routing key `%s`; aborting!",
144+
this.queue1, this.exchange, this.routingKey);
143145
return (false);
144146
}
145147
}
@@ -162,8 +164,8 @@ private final boolean register ()
162164

163165
private final String exchange;
164166
private final String queue;
165-
private final String routingKey;
166167
private String queue1;
168+
private final String routingKey;
167169
private final LinkedBlockingQueue<AmqpMessage> sink;
168170

169171
private final class ConsumerCallback

logback-amqp-consumer/src/main/java/ch/qos/logback/amqp/AmqpConsumerAgent.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import java.util.concurrent.LinkedBlockingQueue;
66
import java.util.concurrent.TimeUnit;
77

8-
import ch.qos.logback.core.spi.FilterReply;
9-
108
import ch.qos.logback.amqp.tools.Callbacks;
119
import ch.qos.logback.amqp.tools.DefaultBinarySerializer;
1210
import ch.qos.logback.amqp.tools.DefaultContextAwareCallbacks;
@@ -17,6 +15,7 @@
1715
import ch.qos.logback.core.Context;
1816
import ch.qos.logback.core.filter.Filter;
1917
import ch.qos.logback.core.spi.ContextAwareBase;
18+
import ch.qos.logback.core.spi.FilterReply;
2019
import ch.qos.logback.core.spi.LifeCycle;
2120
import org.slf4j.LoggerFactory;
2221

logback-amqp-consumer/src/main/java/ch/qos/logback/amqp/AmqpConsumerAgentMain.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ public void end (final InterpretationContext ic, final String name)
108108
}
109109

110110
private AmqpConsumerAgent agent;
111-
private final boolean autoStart;
112111
private final List<AmqpConsumerAgent> agents;
112+
private final boolean autoStart;
113113
}
114114

115115
public static final class Configurator

logback-webapp-lib/src/main/java/ch/qos/logback/webapp/EventViewerLayout.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ public EventViewerLayout ()
3535
this.pattern = EventViewerLayout.defaultPattern;
3636
}
3737

38-
public String doLayout (final ILoggingEvent event)
38+
public String doHeaderLayout ()
3939
{
4040
final StringBuilder buffer = new StringBuilder ();
41-
this.doLayout (event, buffer);
41+
this.doHeaderLayout (buffer);
4242
return buffer.toString ();
4343
}
4444

45-
public String doHeaderLayout ()
45+
public String doLayout (final ILoggingEvent event)
4646
{
4747
final StringBuilder buffer = new StringBuilder ();
48-
this.doHeaderLayout (buffer);
48+
this.doLayout (event, buffer);
4949
return buffer.toString ();
5050
}
5151

@@ -141,33 +141,33 @@ protected void buildConverters ()
141141
}
142142
}
143143

144-
protected void doLayout (final ILoggingEvent event, final StringBuilder buffer)
144+
protected void doHeaderLayout (final StringBuilder buffer)
145145
{
146-
buffer.append ("<tr class=\"Event " + event.getLevel ().levelStr + "\">\n");
146+
buffer.append ("<tr class=\"EventHeader\">\n");
147147
Converter<ILoggingEvent> converter = this.convertersHead;
148148
while (converter != null) {
149-
buffer.append ("<td class=\"Event " + this.getConverterName (converter).replace ("\"", "\\\"") + "\">");
150-
converter.write (buffer, event);
151-
buffer.append ("</td>\n");
149+
final String converterName = this.getConverterName (converter);
150+
buffer.append ("<th class=\"EventHeader " + converterName.replace ("\"", "\\\"") + "\">");
151+
buffer.append (Transform.escapeTags (converterName));
152+
buffer.append ("</th>\n");
152153
converter = converter.getNext ();
153154
}
154155
buffer.append ("</tr>\n");
155-
if (event.getThrowableProxy () != null)
156-
this.doLayout (event.getThrowableProxy (), buffer);
157156
}
158157

159-
protected void doHeaderLayout (final StringBuilder buffer)
158+
protected void doLayout (final ILoggingEvent event, final StringBuilder buffer)
160159
{
161-
buffer.append ("<tr class=\"EventHeader\">\n");
160+
buffer.append ("<tr class=\"Event " + event.getLevel ().levelStr + "\">\n");
162161
Converter<ILoggingEvent> converter = this.convertersHead;
163162
while (converter != null) {
164-
final String converterName = this.getConverterName (converter);
165-
buffer.append ("<th class=\"EventHeader " + converterName.replace ("\"", "\\\"") + "\">");
166-
buffer.append (Transform.escapeTags (converterName));
167-
buffer.append ("</th>\n");
163+
buffer.append ("<td class=\"Event " + this.getConverterName (converter).replace ("\"", "\\\"") + "\">");
164+
converter.write (buffer, event);
165+
buffer.append ("</td>\n");
168166
converter = converter.getNext ();
169167
}
170168
buffer.append ("</tr>\n");
169+
if (event.getThrowableProxy () != null)
170+
this.doLayout (event.getThrowableProxy (), buffer);
171171
}
172172

173173
protected void doLayout (final IThrowableProxy throwableHead, final StringBuilder buffer)

0 commit comments

Comments
 (0)