why I can't receive cpp log in android?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

why I can't receive cpp log in android?

209 Views
yhm2046
Contributor II

my os is imx-automotive-10.0.0_2.2.0$, mx8q, now I want to print some log in cpp file like this:

diff --git a/frameworks/av/media/audioserver/main_audioserver.cpp b/frameworks/av/media/audioserver/main_audioserver.cpp
index db5724804a..6ed284e0b4 100644
--- a/frameworks/av/media/audioserver/main_audioserver.cpp
+++ b/frameworks/av/media/audioserver/main_audioserver.cpp
@@ -13,8 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-#define LOG_TAG "audioserver"

+#include <android/log.h>
+#define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,## __VA_ARGS__)
+#define ALOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG, ## __VA_ARGS__)
+#define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG, ## __VA_ARGS__)
+#define LOG_TAG "liwenxiu_audioservice"
 //#define LOG_NDEBUG 0

 #include <fcntl.h>
@@ -136,7 +140,10 @@ int main(int argc __unused, char **argv)
         sp<ProcessState> proc(ProcessState::self());
         sp<IServiceManager> sm = defaultServiceManager();
         ALOGI("ServiceManager: %p", sm.get());
-        AudioFlinger::instantiate();
+  
+         // char * log =(char*) "liwx_tag";
+      ALOGI("------------AudioFlinger::instantiate()----------liwenxiu");
+       AudioFlinger::instantiate();
         AudioPolicyService::instantiate();

         // AAudioService should only be used in OC-MR1 and later.

but I get nothing when I using dmesg and logcat to print, someone can tell me why, if must make some .so files ?

0 Kudos
0 Replies