本文整理汇总了Java中org.eclipse.jetty.util.log.Log类的典型用法代码示例。如果您正苦于以下问题:Java Log类的具体用法?Java Log怎么用?Java Log使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Log类属于org.eclipse.jetty.util.log包,在下文中一共展示了Log类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: setup
import org.eclipse.jetty.util.log.Log; //导入依赖的package包/类
@Before
public void setup() throws IllegalAccessException {
servletContext = Mockito.mock(ServletContext.class);
servlet = new BackendProxyServlet() {
/**
*
*/
private static final long serialVersionUID = 1L;
{
_log = Log.getLogger("junit");
}
@Override
public ServletContext getServletContext() {
return servletContext;
}
};
FieldUtils.writeField(servlet, "_log", Mockito.mock(Logger.class), true);
callback = Mockito.mock(Callback.class);
}
示例6: loadCases
import org.eclipse.jetty.util.log.Log; //导入依赖的package包/类
@TestFactory
@Override
public Stream<DynamicTest> loadCases(String param) throws IOException, URISyntaxException {
return super.loadCases(param)
.map(test -> DynamicTest.dynamicTest(test.getDisplayName(), () -> {
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());
test.getExecutable().execute();
} finally {
try {
server.stop();
} catch (Exception e) {
e.printStackTrace();
}
}
}));
}
示例7: 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();
}
}
}
示例8: 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");
}
}
示例9: getPassword
import org.eclipse.jetty.util.log.Log; //导入依赖的package包/类
/**
* Get a password. A password is obtained by trying
* <UL>
* <LI>Calling <Code>System.getProperty(realm,dft)</Code>
* <LI>Prompting for a password
* <LI>Using promptDft if nothing was entered.
* </UL>
*
* @param realm The realm name for the password, used as a SystemProperty
* name.
* @param dft The default password.
* @param promptDft The default to use if prompting for the password.
* @return Password
*/
public static Password getPassword(String realm, String dft, String promptDft)
{
String passwd = System.getProperty(realm, dft);
if (passwd == null || passwd.length() == 0)
{
try
{
System.out.print(realm + ((promptDft != null && promptDft.length() > 0) ? " [dft]" : "") + " : ");
System.out.flush();
byte[] buf = new byte[512];
int len = System.in.read(buf);
if (len > 0) passwd = new String(buf, 0, len).trim();
}
catch (IOException e)
{
LOG.warn(Log.EXCEPTION, e);
}
if (passwd == null || passwd.length() == 0) passwd = promptDft;
}
return new Password(passwd);
}
示例10: 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;
}
};
}
示例11: 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;
}
};
}
示例12: 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();
}
示例13: createRequest
import org.eclipse.jetty.util.log.Log; //导入依赖的package包/类
protected HttpUriRequest createRequest() throws URISyntaxException {
URIBuilder uriBuilder = new URIBuilder()
.setScheme("http")
.setHost("localhost").setPort(9031)
.setPath("/");
URI uri = uriBuilder.build();
Log.info("Getting URL="+uri);
HttpUriRequest httpUriRequest = new HttpGet(uri);
Log.info("Got URL="+uri);
return httpUriRequest;
}
示例14: fetch
import org.eclipse.jetty.util.log.Log; //导入依赖的package包/类
@GET
public Response fetch() {
File file = new File(cameraDevice.getConfig().getFilePath());
if (file.exists()) {
try {
java.nio.file.Path path = Paths.get(file.getAbsolutePath());
byte[] imageData = Files.readAllBytes(path);
return Response.ok(new ByteArrayInputStream(imageData)).build();
} catch (Exception e) {
Log.getLog().info("Exception: " + e.getMessage(), e);
}
}
// uncomment line below to send non-streamed
return Response.status(Response.Status.NOT_FOUND).build();
}
示例15: resetAndFetch
import org.eclipse.jetty.util.log.Log; //导入依赖的package包/类
@GET
@Path("/reset-and-fetch")
public Response resetAndFetch()
{
// Stop service if running
if (controller.getServiceStatus())
{
controller.stop();
}
controller.setDisplayBoundary(new Boundary());
controller.singleshot();
if (controller.getServerStatus() == ServerStatus.OK) {
return fetch();
} else {
Log.getLog().warn("Cannot fetch last image because an internal server error occured!");
return Response.serverError().build();
}
}