本文整理汇总了Java中com.jcabi.log.Logger.warn方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.warn方法的具体用法?Java Logger.warn怎么用?Java Logger.warn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jcabi.log.Logger
的用法示例。
在下文中一共展示了Logger.warn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connect
import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
* Connect.
* @return Region
*/
private static Region connect() {
final String key = Manifests.read("Rehttp-DynamoKey");
final Credentials creds = new Credentials.Simple(
key, Manifests.read("Rehttp-DynamoSecret")
);
final Region region;
if (key.startsWith("AAAAA")) {
final int port = Integer.parseInt(
System.getProperty("dynamo.port")
);
region = new Region.Simple(new Credentials.Direct(creds, port));
Logger.warn(Entrance.class, "Test DynamoDB at port #%d", port);
} else {
region = new Region.Prefixed(
new ReRegion(new Region.Simple(creds)),
"rehttp-"
);
}
Logger.info(Entrance.class, "DynamoDB connected as %s", key);
return region;
}
示例2: connect
import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
* Connect.
* @return Region
*/
private static Region connect() {
final String key = Manifests.read("ThreeCopies-DynamoKey");
final Credentials creds = new Credentials.Simple(
key, Manifests.read("ThreeCopies-DynamoSecret")
);
final Region region;
if (key.startsWith("AAAAA")) {
final int port = Integer.parseInt(
System.getProperty("dynamo.port")
);
region = new Region.Simple(new Credentials.Direct(creds, port));
Logger.warn(Dynamo.class, "Test DynamoDB at port #%d", port);
} else {
region = new Region.Prefixed(
new ReRegion(new Region.Simple(creds)),
"tc-"
);
}
Logger.info(Dynamo.class, "DynamoDB connected as %s", key);
return region;
}
示例3: connect
import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
* Connect.
* @return Region
*/
private static Region connect() {
final String key = Manifests.read("Jare-DynamoKey");
final Credentials creds = new Credentials.Simple(
key, Manifests.read("Jare-DynamoSecret")
);
final Region region;
if (key.startsWith("AAAAA")) {
final int port = Integer.parseInt(
System.getProperty("dynamo.port")
);
region = new Region.Simple(new Credentials.Direct(creds, port));
Logger.warn(Dynamo.class, "test DynamoDB at port #%d", port);
} else {
region = new Region.Prefixed(
new ReRegion(new Region.Simple(creds)),
"jare-"
);
}
Logger.info(Dynamo.class, "DynamoDB connected as %s", key);
return region;
}
示例4: identifyAssignee
import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
* RtIssue can fetch assignee.
*
* <p> If you get AssertionError during this test execution and test was
* ignored it means that something happened with account that you try to
* edit with Issue.assign(). We had this problem when our account was
* flagged as suspicious by Github. In this case you should contact Github
* support and ask them to unblock account you use.
*
* @see <a href="https://github.com/jcabi/jcabi-github/issues/810">Why test is ignored?</a>
* @throws Exception if any problem inside.
*/
@Test
public void identifyAssignee() throws Exception {
final Issue issue = RtIssueITCase.issue();
final String login = issue.repo().github().users().self().login();
try {
new Issue.Smart(issue).assign(login);
} catch (final AssertionError error) {
Logger.warn(this, "Test failed with error: %s", error.getMessage());
Assume.assumeFalse(
"Something wrong with your test account. Read test's java-doc.",
true
);
}
final User assignee = new Issue.Smart(issue).assignee();
MatcherAssert.assertThat(
assignee.login(),
Matchers.equalTo(login)
);
}
示例5: apply
import com.jcabi.log.Logger; //导入方法依赖的package包/类
@Override
public final Statement apply(
final Statement base, final Description description
) {
return new Statement() {
@Override
// @checkstyle IllegalThrowsCheck (1 line)
public void evaluate() throws Throwable {
try {
base.evaluate();
} catch (final BindException ignored) {
Logger.warn(
base,
String.format(
"Test %s skipped due to no available ports",
description
)
);
Assume.assumeTrue(false);
}
}
};
}
示例6: unwrap
import com.jcabi.log.Logger; //导入方法依赖的package包/类
@Override
public Message unwrap() throws IOException {
final Message msg = this.origin.unwrap();
try {
if (msg.getAllRecipients() == null) {
msg.addRecipient(
Message.RecipientType.TO,
new InternetAddress("[email protected]")
);
Logger.warn(this, "recipients were NULL, fake one set");
}
if (msg.getFrom() == null) {
msg.setFrom(new InternetAddress("[email protected]"));
Logger.warn(this, "senders were NULL, fake one set");
}
if (msg.getSubject() == null) {
msg.setSubject(this.getClass().getCanonicalName());
Logger.warn(this, "subject was NULL, fake one set");
}
} catch (final MessagingException ex) {
throw new IOException(ex);
}
return msg;
}
示例7: isValid
import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
* Check whether the URI is valid and returns code 200.
* @param uri The URI to check
* @return TRUE if it's valid
*/
private static boolean isValid(final URI uri) {
boolean valid = false;
try {
final int code = NoBrokenLinks.http(uri.toURL());
if (code < HttpURLConnection.HTTP_BAD_REQUEST) {
valid = true;
} else {
Logger.warn(
NoBrokenLinks.class,
"#isValid('%s'): not valid since response code is %d",
uri, code
);
}
} catch (final MalformedURLException ex) {
Logger.warn(
NoBrokenLinks.class,
"#isValid('%s'): invalid URL: %s",
uri, ex.getMessage()
);
}
return valid;
}
示例8: check
import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
* Check report for errors.
* @param report The report
* @throws ValidationException If it contains errors
*/
private void check(final String report) throws ValidationException {
int total = 0;
for (final String line
: report.split(System.getProperty("line.separator"))) {
if (line.matches("[a-zA-Z ]+: .*")) {
Logger.warn(this, "FindBugs: %s", line);
++total;
}
}
if (total > 0) {
throw new ValidationException(
"%d FindBugs violations (see log above)",
total
);
}
}
示例9: apply
import com.jcabi.log.Logger; //导入方法依赖的package包/类
@Override
public Statement apply(final Statement stmt, final Description desc) {
// @checkstyle IllegalThrows (10 lines)
return new Statement() {
@Override
public void evaluate() throws Throwable {
if (BucketRule.KEY == null || BucketRule.KEY.isEmpty()) {
Logger.warn(
this,
"system property failsafe.s3.key is not set, skipping"
);
} else {
BucketRule.this.create();
try {
stmt.evaluate();
} finally {
BucketRule.this.drop();
}
}
}
};
}
示例10: interrupted
import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
* This thread is stopped already (interrupt if not)?
* @return TRUE if it's already dead
*/
public boolean interrupted() {
boolean dead;
if (this.thread.isAlive()) {
this.thread.interrupt();
final Method method = MethodSignature.class
.cast(this.point.getSignature())
.getMethod();
Logger.warn(
method.getDeclaringClass(),
"%s: interrupted on %[ms]s timeout (over %[ms]s)",
Mnemos.toText(this.point, true, false),
System.currentTimeMillis() - this.start,
this.deadline - this.start
);
dead = false;
} else {
dead = true;
}
return dead;
}
示例11: copyUnwovenClasses
import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
* Copy the unwoven classes from <b>classesDirectory</b> to
* <b>unwovenClassesDir</b>.
* @throws MojoFailureException If something goes wrong
*/
private void copyUnwovenClasses()
throws MojoFailureException {
if (this.hasClasses()) {
new UnwovenClasses(
this.unwovenClassesDir,
this.classesDirectory,
this.execution.getLifecyclePhase()
).copy();
} else {
Logger.warn(
this,
"No classes found at %s. Nothing will be copied to %s",
this.classesDirectory,
this.unwovenClassesDir
);
}
}
示例12: StrictXML
import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
* Private ctor.
* @param xml XML Document
* @param errors XML Document errors
*/
@SuppressWarnings("PMD.ConstructorOnlyInitializesOrCallOtherConstructors")
private StrictXML(final XML xml,
final Collection<SAXParseException> errors) {
if (!errors.isEmpty()) {
Logger.warn(
StrictXML.class,
"%d XML validation error(s):\n %s\n%s",
errors.size(),
StrictXML.join(StrictXML.print(errors), "\n "),
xml
);
throw new IllegalArgumentException(
String.format(
"%d error(s) in XML document: %s",
errors.size(),
StrictXML.join(StrictXML.print(errors), ";")
)
);
}
this.origin = xml;
}
示例13: dynamo
import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
* Dynamo DB region.
* @return Region
*/
private Region dynamo() {
final String key = Manifests.read("Bib-DynamoKey");
Credentials creds = new Credentials.Simple(
key,
Manifests.read("Bib-DynamoSecret")
);
if (key.startsWith("AAAAA")) {
final int port = Integer.parseInt(
System.getProperty("dynamo.port")
);
creds = new Credentials.Direct(creds, port);
Logger.warn(this, "test DynamoDB at port #%d", port);
}
return new Region.Prefixed(
new ReRegion(new Region.Simple(creds)), "bib-"
);
}
示例14: wrap
import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
* Catch exception and log it.
*
* <p>Try NOT to change the signature of this method, in order to keep
* it backward compatible.
*
* @param point Joint point
* @return The result of call
* @throws Throwable If something goes wrong inside
*/
@Around
(
// @checkstyle StringLiteralsConcatenation (2 lines)
"execution(* * (..))"
+ " && @annotation(com.jcabi.aspects.LogExceptions)"
)
@SuppressWarnings("PMD.AvoidCatchingThrowable")
public Object wrap(final ProceedingJoinPoint point) throws Throwable {
try {
return point.proceed();
// @checkstyle IllegalCatch (1 line)
} catch (final Throwable ex) {
Logger.warn(
new ImprovedJoinPoint(point).targetize(),
"%[exception]s",
ex
);
throw ex;
}
}
示例15: connect
import com.jcabi.log.Logger; //导入方法依赖的package包/类
/**
* Connecto to PubSub
*/
public void connect() {
if (getConnectionState().equals(TMIConnectionState.DISCONNECTED)) {
try {
getWebSocket().connect();
setConnectionState(TMIConnectionState.CONNECTING);
} catch (Exception ex) {
setConnectionState(TMIConnectionState.DISCONNECTED);
Logger.error(this, "Connection to Twitch PubSub failed: [%s]", ex.getMessage());
}
} else {
Logger.warn(this, "Cannot connecting to Twitch PubSub: is already [%s].", getConnectionState().name().toUpperCase());
}
}