首页 \ 问答 \ 希望使“System.out.println()”将消息打印到log4j(Want to make “System.out.println()” to print message to log4j)

希望使“System.out.println()”将消息打印到log4j(Want to make “System.out.println()” to print message to log4j)

我们的项目使用System.out.println()或System.err.println()来输出调试消息。 现在我们要使用log4j将这些输出引导到日志文件,而不仅仅是控制台。 为避免影响或风险,我们不希望用“logger.debug”替换所有“System.out.println()”,但只是想编写几个代码来使这些输出重定向到log4j日志文件仍然使用System.out.println()的每个类中的代码更改(我们知道这是不好的做法,但我们不希望全局搜索和替换当前)。 可能吗? 谢谢。


our project uses System.out.println() or System.err.println() to output debugging message. Now we want to use log4j to direct these output to log files not just console. To avoid impact or risk, we don't want to do replace all "System.out.println()" with "logger.debug" but just want to maybe write several code to make these output redirect to log4j log files that is no code change in each class still using System.out.println() (we know this is bad practice but we don't want to do global search and replace currently). Is it possible? Thanks.


原文:https://stackoverflow.com/questions/6566960
更新时间:2022-04-08 15:04

最满意答案

你的logcat日志没用,没有Facebook错误。 你可能在你的代码中错过了这个:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    callbackManager.onActivityResult(requestCode, resultCode, data);
}

请阅读Facebook登录教程


Your logcat log is useless, there are no Facebook errors. You probably miss this in your code:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    callbackManager.onActivityResult(requestCode, resultCode, data);
}

Please, read Facebook login tutorial.

相关问答

更多
  • 您不需要任何SKD就可以使用Graph API。 在与Facebook合作时,他们会让事情变得更轻松,并且已经为您做了很多事情。 You don't need any SKDs in order to use Graph API. They just make things easier when working with Facebook, having a lot of stuff already done for you.
  • 在Android Studio 1.1中使用Facebook SDK 3.23预览2 两个选择: * Facebook SDK的Maven存储库。 dependencies { compile 'com.facebook.android:facebook-android-sdk:4.7.0' } 检查最新版本的facebook sdk 要么 *按照以下步骤: 1.下载facebook sdk https://developers.facebook.com/docs/android/ 2.解压缩档案 ...
  • 注意 对于Android Studio 0.5.5及更高版本以及随后版本的SDK SDK,此过程要比下面所述的更简单(这是为两者的早期版本编写的)。 如果你运行最新的,你需要做的就是这样做: 从https://developers.facebook.com/docs/android/下载Facebook SDK 解压缩档案 在Android Studio 0.5.5或更高版本中,从文件菜单中选择“导入模块”。 在向导中,将要导入的模块的源路径设置为未打包的存档中的“facebook”目录。 (注意:如果选择 ...
  • 你的logcat日志没用,没有Facebook错误。 你可能在你的代码中错过了这个: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); callbackManager.onActivityResult(requestCode, resultCode, da ...
  • 当用户在Facebook.com上加载Canvas和Page Tab应用程序时, signed_request字段将POST到您的服务器,它与本机移动应用程序无关 The signed_request field is POSTed to your server when a user loads your Canvas and Page Tab App on Facebook.com, it's not relevant to native mobile apps
  • 假设您已经使用Android完成了本地开发的Facebook SDK教程,我将从以下链接开始,该链接提供了一个30分钟的教程,可以逐步将Facebook集成添加到您的Android应用程序中。 至于你正在安装Facebook.apk的原因,请查看Facebook教程的第6.3节 ,其中指出: 您的应用程序仍然可以在不安装此映像的情况下运行,但我们将默认使用平台对话框进行登录,而不是使用Facebook应用程序,要求用户每次在模拟器中运行应用程序时都要登录。 因此,如果您未安装Facebook.apk,则每次 ...
  • 好的,这很奇怪,但是从我的Manifest文件中删除这一行之后,它再次起作用: 从这个网站找到它。 Ok, this is weird, but after removing this line from my Manifest file, it works again:
  • 我使用本指南在Samsung Galaxy S手机上运行使用Facebook SDK for Android的应用程序: http : //blog.doityourselfandroid.com/2011/02/28/30-minute-guide-integrating-facebook-android-application / I have an application using the Facebook SDK for Android running on a Samsung Galaxy S ...
  • 我一直面临同样的问题,最后我发现了这个问题 public void logout() { Session session = Session.getActiveSession(); if (session != null) { session.closeAndClearTokenInformation(); } else { Session session2 = Session.openActiveSession((Activity)c ...
  • 你可以使用facebook sdk 4.5,从4.6开始,最小API为15 you can use facebook sdk 4.5, from 4.6 onward minimum API is 15

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。