本文整理汇总了Java中org.eclipse.jetty.util.log.Log.setLog方法的典型用法代码示例。如果您正苦于以下问题:Java Log.setLog方法的具体用法?Java Log.setLog怎么用?Java Log.setLog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jetty.util.log.Log
的用法示例。
在下文中一共展示了Log.setLog方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.eclipse.jetty.util.log.Log; //导入方法依赖的package包/类
public @NotNull CollectorServer init(@NotNull InetSocketAddress address, @NotNull ExpositionFormat format) {
try {
Log.setLog(new Slf4jLog());
final Server serverInstance = new Server(address);
format.handler(serverInstance);
serverInstance.start();
server = serverInstance;
Logger.instance.info("Prometheus server with JMX metrics started at " + address);
} catch (Exception e) {
Logger.instance.error("Failed to start server at " + address, e);
}
return this;
}
示例2: setUpServer
import org.eclipse.jetty.util.log.Log; //导入方法依赖的package包/类
@Before
public void setUpServer() throws Exception {
Awaitility.setDefaultPollDelay(2, TimeUnit.MILLISECONDS);
Log.setLog(new NoLogging());
impl = mock(TestService.Iface.class);
instrumentation = mock(ServiceCallInstrumentation.class);
provider = new DefaultSerializerProvider();
server = new Server(0);
ServletContextHandler handler = new ServletContextHandler();
handler.addServlet(new ServletHolder(new ProvidenceServlet(new TestService.Processor(impl), provider, instrumentation)),
"/" + ENDPOINT);
server.setHandler(handler);
server.start();
port = getExposedPort(server);
}
示例3: setUpServer
import org.eclipse.jetty.util.log.Log; //导入方法依赖的package包/类
@BeforeClass
public static void setUpServer() throws Exception {
Awaitility.setDefaultPollDelay(2, TimeUnit.MILLISECONDS);
Log.setLog(new NoLogging());
impl = mock(TestService.Iface.class);
instrumentation = mock(ServiceCallInstrumentation.class);
provider = new DefaultSerializerProvider();
server = new Server(0);
ServletContextHandler handler = new ServletContextHandler();
handler.addServlet(new ServletHolder(new ProvidenceServlet(new TestService.Processor(impl), provider, instrumentation)),
"/" + ENDPOINT);
server.setHandler(handler);
server.start();
port = getExposedPort(server);
}
示例4: onRegister
import org.eclipse.jetty.util.log.Log; //导入方法依赖的package包/类
@Override
public void onRegister(CompileScope scope) {
registerWrapperClass(scope, Session.class, PWebSocketSession.class);
MemoryOperation.registerWrapper(WebSocketSession.class, PWebSocketSession.class);
registerClass(scope, PHttpServer.class);
registerClass(scope, PHttpServerRequest.class);
registerClass(scope, PHttpServerResponse.class);
registerClass(scope, PHttpAbstractHandler.class);
registerClass(scope, PHttpRouteFilter.class);
registerClass(scope, PHttpRouteHandler.class);
registerClass(scope, PHttpRedirectHandler.class);
registerClass(scope, PHttpDownloadFileHandler.class);
registerClass(scope, PHttpResourceHandler.class);
registerClass(scope, PHttpCORSFilter.class);
registerClass(scope, PHttpGzipFilter.class);
Log.setLog(new NoLogging());
}
示例5: concreteTest
import org.eclipse.jetty.util.log.Log; //导入方法依赖的package包/类
@Test
public void concreteTest() throws Exception {
HistoneTestCase.Case testCase = new HistoneTestCase.Case();
testCase.setExpectedResult("true");
testCase.setContext(getMap());
testCase.setInput("{{var response = loadJSON('http://127.0.0.1:4442/', [headers: ['via': 123]])}}{{response -> isArray() && response.headers['via'] != '123'}}");
try {
ServletContextHandler servletContextHandler = new ServletContextHandler(ServletContextHandler.SESSIONS);
servletContextHandler.setContextPath("/");
// CXF Servlet
ServletHolder cxfServletHolder = new ServletHolder(new CXFNonSpringJaxrsServlet());
cxfServletHolder.setInitParameter("jaxrs.serviceClasses", TestServerResource.class.getName());
servletContextHandler.addServlet(cxfServletHolder, "/*");
server = new Server(4442);
server.setHandler(servletContextHandler);
server.start();
Log.setLog(new StdErrLog());
new CoreTestConsumer(parser, rtti, evaluator).accept(testCase);
} finally {
try {
server.stop();
} catch (Exception e) {
e.printStackTrace();
}
}
}
示例6: initializeJettyLogging
import org.eclipse.jetty.util.log.Log; //导入方法依赖的package包/类
private static void initializeJettyLogging() {
// Note: Jetty is logging stderr if no logger is explicitly configured.
try {
Log.setLog(new JavaUtilLog());
} catch (Exception e) {
throw new RuntimeException("Unable to initialize logging framework for Jetty");
}
}
示例7: setUp
import org.eclipse.jetty.util.log.Log; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
Log.setLog(new NoLogging());
rc = copyResourceTo("/pvdrc", temp.getRoot());
copyResourceTo("/test.thrift", temp.getRoot());
impl = Mockito.mock(MyService.Iface.class);
TServerSocket transport = new TServerSocket(0);
server = new TSimpleServer(
new TServer.Args(transport)
.protocolFactory(new TBinaryProtocol.Factory())
.processor(new MyService.Processor<>(impl)));
ExecutorService executor = Executors.newSingleThreadExecutor();
executor.submit(server::serve);
Thread.sleep(1);
port = transport.getServerSocket().getLocalPort();
exitCode = 0;
rpc = new RPC(console.tty()) {
@Override
protected void exit(int i) {
exitCode = i;
}
};
}
示例8: setUp
import org.eclipse.jetty.util.log.Log; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
Log.setLog(new NoLogging());
rc = copyResourceTo("/pvdrc", temp.getRoot());
copyResourceTo("/test.thrift", temp.getRoot());
impl = mock(MyService.Iface.class);
server = new Server(0);
DefaultSerializerProvider provider = new DefaultSerializerProvider();
ServletContextHandler handler = new ServletContextHandler();
handler.addServlet(new ServletHolder(new ProvidenceServlet(new MyService.Processor(impl), provider)),
"/" + ENDPOINT);
server.setHandler(handler);
server.start();
port = getExposedPort(server);
Thread.sleep(1);
exitCode = 0;
rpc = new RPC(console.tty()) {
@Override
protected void exit(int i) {
exitCode = i;
}
};
}
示例9: initialize
import org.eclipse.jetty.util.log.Log; //导入方法依赖的package包/类
public void initialize() {
Log.setLog(new JettyLogger());
// configure the web service.
Spark.port(2000);
DefaultWebServiceFilters.apply(OpenHabboRoomService.getInstance().getServiceConfiguration());
this.applyRoutes();
}
示例10: WebServer
import org.eclipse.jetty.util.log.Log; //导入方法依赖的package包/类
/**
* Constructs the web server
*/
public WebServer()
{
SecurityActions.setSystemProperty("org.eclipse.jetty.util.log.class", JavaUtilLog.class.getName());
Log.setLog(new JavaUtilLog());
this.server = null;
this.host = "localhost";
this.port = 8080;
this.mbeanServer = null;
this.acceptQueueSize = 64;
this.executorService = null;
this.handlers = new HandlerList();
}
示例11: HttpdForTests
import org.eclipse.jetty.util.log.Log; //导入方法依赖的package包/类
public HttpdForTests() throws SocketException {
// Configure the logging for jetty. Which uses a singleton. Ho hum.
Log.setLog(new JavaUtilLog());
server = new Server();
ServerConnector connector = new ServerConnector(server);
connector.addConnectionFactory(new HttpConnectionFactory());
// Choose a port randomly upon listening for socket connections.
connector.setPort(0);
server.addConnector(connector);
handlerList = new HandlerList();
localhost = getLocalhostAddress().getHostAddress();
}
示例12: doTest
import org.eclipse.jetty.util.log.Log; //导入方法依赖的package包/类
@Test
public void doTest() throws Exception {
String tpl = "{{var a = loadJSON('http://127.0.0.1:4442/testCache'), b = false && loadJSON('http://127.0.0.1:4442/testCache'),ba = false && loadJSON('http://127.0.0.1:4442/testCache'),bb = false && loadJSON('http://127.0.0.1:4442/testCache')}}{{var r = a + b + ba + bb}}{{var c = [key: loadJSON('http://127.0.0.1:4442/testCache', [data: [ololo: r]]).requestCount, r:r]}}{{c.key = 2}}";
String expectedAST = "[29,[24,[29,\"true\"],[6,[6,[6,[6,[6,[6,[15,1,3],[16,2,0]],[18,5,6]],[18,6,6]],[17,7,8]],[17,7,7]],[19,8,8]],[29,\"false\"]]]";
// String expectedAST = "[29,[23,9,0],[21,0,0]]";
String expectedResult = "true";
Translator translator = new Translator();
// AstNode tree = AstJsonProcessor.read(expectedAST);
//
AstNode tree = parser.process(tpl, "");
SsaOptimizer optimizer = new SsaOptimizer();
optimizer.process(tree);
expectedAST = AstJsonProcessor.write(tree);
byte[] classBytes = translator.compile("Template1", tree);
Map<String, byte[]> classes = Collections.singletonMap("Template1", classBytes);
ByteClassLoader loader = new ByteClassLoader(new URL[]{}, getClass().getClassLoader(), classes);
Class<?> t = loader.loadClass("Template1");
StdLibrary library = new StdLibrary(converter);
Template template = (Template) t.newInstance();
template.setStdLibrary(library);
template.setConverter(converter);
Assert.assertEquals(template.getStringAst(), expectedAST);
String baseURI = "acceptance/simple/function/global";
Context context = Context.createRoot(baseURI, US_LOCALE, rtti, new DefaultPropertyHolder());
ServletContextHandler servletContextHandler = new ServletContextHandler(ServletContextHandler.SESSIONS);
servletContextHandler.setContextPath("/");
// CXF Servlet
ServletHolder cxfServletHolder = new ServletHolder(new CXFNonSpringJaxrsServlet());
cxfServletHolder.setInitParameter("jaxrs.serviceClasses", TestServerResource.class.getName());
servletContextHandler.addServlet(cxfServletHolder, "/*");
Server server = new Server(4442);
server.setHandler(servletContextHandler);
server.start();
Log.setLog(new StdErrLog());
// if (testCase.getContext() != null) {
// for (Map.Entry<String, Object> entry : getMap().entrySet()) {
// if (entry.getKey().equals("this")) {
// context.put("this", CompletableFuture.completedFuture(converter.constructFromObject(entry.getValue())));
// } else {
// context.getVars().put(entry.getKey(), CompletableFuture.completedFuture(converter.constructFromObject(entry.getValue())));
// }
// }
// }
String result = template.render(context)
.thenCompose(v -> RttiUtils.callToString(context, v))
.thenApply(n -> ((StringEvalNode) n).getValue())
.join();
Assert.assertEquals(result, expectedResult);
}
示例13: initialize
import org.eclipse.jetty.util.log.Log; //导入方法依赖的package包/类
public void initialize() {
Log.setLog(new JettyLogger());
// configure the web service.
Spark.port(OpenHabboPeerService.getInstance().getPeerServiceConfiguration().getServicePort());
DefaultWebServiceFilters.apply(OpenHabboPeerService.getInstance().getServiceConfiguration());
this.applyRoutes();
}
示例14: create
import org.eclipse.jetty.util.log.Log; //导入方法依赖的package包/类
public Server create() {
Log.setLog(new JavaUtilLog());
Server server = new Server(createThreadPool());
server.addBean(createClassList());
server.setStopAtShutdown(true);
server.setConnectors(createConnectors(server));
return server;
}