Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Androidのログ出力をいい感じにする #potatotips 9
Search
Tatsuya Arai
September 24, 2014
Programming
10k
8
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Androidのログ出力をいい感じにする #potatotips 9
Tatsuya Arai
September 24, 2014
More Decks by Tatsuya Arai
See All by Tatsuya Arai
5 minutes PWA
cutmail
0
250
Androidアプリ開発における技術顧問としての役割 #DroidKaigi 2018
cutmail
1
2.5k
4年続くアプリにおけるチーム開発 #DroidKaigi 2017
cutmail
13
5.1k
フリルにおけるドッグフーディング / Fashion Tech Meetup #2 LT
cutmail
2
4k
Adapter and Custom Layout
cutmail
3
1k
いかにして不具合発見時の フィードバックを素早く行うか #potatotips 12
cutmail
0
2.7k
コーディング規約を緩く守りつつ仕事の成果を出す方法
cutmail
2
680
Other Decks in Programming
See All in Programming
Jetpack Compose Mechanisms
skydoves
3
880
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
210
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
340
S3 TablesのIcebergデータに、AIエージェントからアクセスしてみた / 20261016developersio2026joetsu-accessing-iceberg-in-s3tables-via-agent
kasacchiful
PRO
0
220
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
130
APNsからLive Activityを開始する話
yumnumm
0
180
Performance Optimization With LLMs
xleitix
0
210
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
3
1.3k
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
200
HTML-in-Canvasで作る未来のWeb UI表現
clockmaker
5
5.9k
AmebaブログはKMPから卒業します
kmars0605
0
280
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
150
Featured
See All Featured
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
580
Believing is Seeing
oripsolob
1
250
Documentation Writing (for coders)
carmenintech
77
5.6k
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
270
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
2
2.1k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
310
Paper Plane
katiecoart
PRO
5
54k
We Have a Design System, Now What?
morganepeng
55
8.4k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
530
WENDY [Excerpt]
tessaabrams
14
40k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
560
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.8k
Transcript
"OESPJEͷϩάग़ྗΛ ͍͍ײ͡ʹ͢Δ QPUBUPUJQT
@cutmail • Fablic, Inc. • iOS / Android App Developer.
Agenda • AndroidΞϓϦ։ൃʹ͓͚ΔLog • Α͋͘Δ • Timber • Timberͷ͍ํ •
·ͱΊ
Log • Debug Log • Crash Log • Event Tracking
Log
Build Variants • Build Types • ϏϧυઃఆΛΓସ͑ΔΈ • debug, release
• Product Flavours • ΞϓϦʹผ໊Λ͚ͨΓɺҰ෦Λมߋͨ͠ΓͰ͖ΔΈ • FlavorຖʹAndroidManifestϦιʔεΛ࣋ͯΔ • Free, Normal • Staging, Production
#VJME7BSJBOUTͰ։ൃ൛"OESPJEΞϓϦΛ͚Δ IUUQOJOKJOLVOIBUFOBCMPHDPNFOUSZ
ϏϧυڥʹΑΔ߹͚ EFCVH SFMFBTF ϩάग़ྗ ̋ ✕ $SBTIMZUJDT ✕ ̋ Πϕϯτϩά
✕ ̋
σόοάϩάͬͯ Ͳ͏ͯ͠·͔͢ʁ
Log.d(“MainActivity”, "Activity Created”);
ΈΜͳେ͖ LogΫϥε
public class MainActivity extends Activity { private static final String
TAG = MainActivity.class.getSimpleName(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "MainActivity created!"); } } Α͋͘Δ࣮
Α͋͘Δ࣮ public class Util { public static void log(String message)
{ if (BuildConfig.DEBUG) { Log.d("DemoAppLog", message); } } }
Α͋͘Δ࣮2 public class Logger { public static final void d(String
tag, String msg) { if (BuildConfig.DEBUG) { Log.d(tag, msg); } } public static final void e(String tag, String msg) { if (BuildConfig.DEBUG) { Log.e(tag, msg); } } public static final void i(String tag, String msg) { if (BuildConfig.DEBUG) { Log.i(tag, msg); } } }
ى͜Γ͕ͪͳ͜ͱ • releaseϏϧυͳͷʹσόοάϩάग़ྗ • debugϏϧυͳͷʹCrashlyticsʹૹ৴͞ΕͯΔ
AndroidͷLogϥΠϒϥϦ • android-logging-log4j • SLF4J • hugo
None
• https://github.com/JakeWharton/timber • ҆৺ͷSquareɺJakeWharton࡞ • AndroidͷLogΫϥεͷϥούʔ • ࣮ଶ1ͭͷϑΝΠϧ • ʮࡐʯ
Tree public interface Tree { void v(String message, Object... args);
void v(Throwable t, String message, Object... args); void d(String message, Object... args); void d(Throwable t, String message, Object... args); void i(String message, Object... args); void i(Throwable t, String message, Object... args); void w(String message, Object... args); void w(Throwable t, String message, Object... args); void e(String message, Object... args); void e(Throwable t, String message, Object... args); }
͍ํ • ApplicationΫϥεͷonCreateͰTreeΫϥεͷΠϯ ελϯεΛ࡞ͬͯTimberʹplant͢Δ public class ExampleApp extends Application {
@Override public void onCreate() { super.onCreate(); if (BuildConfig.DEBUG) { Timber.plant(new DebugTree()); } else { Timber.plant(new CrashReportingTree()); } } }
HollowTree 5SFFΠϯλϑΣʔεΛ࣮ͨ͠ςϯϓϨʔτΫϥε public static class HollowTree implements Tree { @Override
public void v(String message, Object... args) { } @Override public void v(Throwable t, String message, Object... args) { } @Override public void d(String message, Object... args) { } @Override public void d(Throwable t, String message, Object... args) { } }
ಠࣗͷTreeΛ࡞Δ private static class CrashReportingTree extends Timber.HollowTree { @Override public
void i(String message, Object... args) { i(message, args); Crashlytics.log(String.format(message, args)); } @Override public void i(Throwable t, String message, Object... args) { i(message, args); } @Override public void e(String message, Object... args) { e("ERROR: " + message, args); } @Override public void e(Throwable t, String message, Object... args) { e(message, args); Crashlytics.logException(t); } }
͍ํ2 (ϩάͷग़ྗ) • ΞϓϦ͔ΒTimberͷstaticϝιουΛݺͼग़͢ @Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); setContentView(R.layout.demo_activity); Timber.d("Activity Created”); }
@OnClick({ R.id.hello, R.id.hey, R.id.hi }) public void greetingClicked(Button button) {
Timber.i("A button with ID %s was clicked to say ‘%s'.", button.getId(), button.getText()); }
Timberͷ͓࡞๏ • BehaviorTreeΛ௨ͯ͠ఆٛ͢Δ • Timber.plantͰҙͷTreeΠϯελϯε͕Πϯε τʔϧͰ͖Δ • ෳͷTreeΛplantͰ͖Δ • ༻ҙ͞Ε͍ͯΔDebugTreeΛ͏ͱɺݺͼग़͞Εͨ
Ϋϥε͔ΒࣗಈͰTAGΛઃఆͯ͘͠ΕΔ
Treeͱ͍͏֓೦ͱ ͦͷΠϯλϑΣʔε͕؊
ͭ·Γ
TreeΠϯλϑΣʔεΛ ௨ͯ͠
͚ࣗͩͷTreeΛ࡞Ε
ͱ͍͏͜ͱ
Timber.plant public static void plant(Tree tree) { if (tree instanceof
TaggedTree) { TAGGED_TREES.append(FOREST.size(), true); } FOREST.add(tree); }
Timber.uproot /** Remove a planted tree. */ public static void
uproot(Tree tree) { for (int i = 0, size = FOREST.size(); i < size; i++) { if (FOREST.get(i) == tree) { TAGGED_TREES.delete(i); FOREST.remove(i); return; } } throw new IllegalArgumentException( "Cannot uproot tree which is not planted: " + tree); }
Timberͷྑ͍ͱ͜Ζ • LogΫϥεͷϥούʔͳͷͰϥΠϒϥϦࣗମ͕ബ͘ɺ ಋೖ͕؆୯ • TreeͷΠϯλϑΣʔε͕༻ҙ͞Ε͍ͯͯɺॻ͖͍͢ • LogΛ͏ͱ͖ʹඞਢͩͬͨɺTAGΛॻ͘ඞཁ͕ͳ͍ • ҾʹϑΥʔϚοτจͱΦϒδΣΫτΛͤΔ
• JakeWhartonͳͷͰ҆৺
·ͱΊ • TimberLogΫϥεͷബ͍ϥούʔ • LogΫϥεΛͦͷ··͏ͳΒɺTimber͍·͠ΐ ͏
ΤϯδχΞืूத