1 /*
2 * Copyright 2007 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.goetz.domino.log4j;
18
19 import junit.framework.TestCase;
20 import lotus.domino.NotesThread;
21
22 import org.apache.log4j.LogManager;
23 import org.apache.log4j.Logger;
24
25 /***
26 * Class to test the RemoteAppender.
27 *
28 * @author Bernd Götz
29 */
30 public class RemoteLoggingTest extends TestCase {
31
32 public void testRemoteConnect() throws Exception {
33
34 // String log4jConfig = "test/config/remote1.properties";
35 //
36 // File f = new File(log4jConfig);
37 // assertTrue(f.exists());
38 //
39 // Properties p = new Properties();
40 // p.load(new StringBufferInputStream(log4jConfig));
41 //
42 // // configure log4j now:
43 // LogManager.resetConfiguration();
44 // PropertyConfigurator.configure(p);
45 // PrintWriter pw = new PrintWriter(System.out);
46 // PropertyPrinter pp = new PropertyPrinter(pw);
47 // System.out.println("-- Current config start");
48 // pp.print(pw);
49 // System.out.println("-- Current config end");
50
51 // needs to have 'test/config' on the class path for this:
52
53 NotesThread.sinitThread();
54
55 Logger log = Logger.getLogger("RemoteLoggingTest");
56
57 log.info("Hallo, Welt! xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
58 Thread.sleep(1500);
59 log.info("Hallo, Welt 2! xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
60 Thread.sleep(1500);
61 log.info("Hallo, Welt 3! xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
62
63 for (int i = 0; i < 300; i++) {
64 log.info("Hallo, Welt! " + i + " xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
65 }
66
67 LogManager.shutdown();
68
69 // now check the log database
70
71 NotesThread.stermThread();
72
73 }
74
75 }