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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
5k
フリルにおけるドッグフーディング / Fashion Tech Meetup #2 LT
cutmail
2
4k
Adapter and Custom Layout
cutmail
3
990
いかにして不具合発見時の フィードバックを素早く行うか #potatotips 12
cutmail
0
2.6k
コーディング規約を緩く守りつつ仕事の成果を出す方法
cutmail
2
670
Other Decks in Programming
See All in Programming
【高い買い物LT会】初任給で話題の国産フィジカルAIを買った話
akagami
PRO
0
160
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
140
Building an Out-of-Order CPU
latte72
1
780
How I Stole PSI from Android Studio - DroidKaigi2026
worker8
0
130
市販E-Readerを乗っ取れ 〜Embedded Swiftで電子ペーパーガジェットを制御する〜
trickart
0
190
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
210
AI × TiDD / 2026.09.05 Redmine 大阪
tokudiro
1
170
Java 27新機能 / Java 27 new features
kishida
2
140
SREの越境 / SRE Collaboration
y0hgi
1
210
フロントエンドUIフレームワークのこれまでとこれから
ssssota
5
2.8k
AGENTS.md Is Not Enough:Build Skills, Don't Download Them
lx_t
0
120
海上で動くGoサーバー: goroutineとchannelでさばく航行データストリーム
atsuki_seo
0
720
Featured
See All Featured
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.2k
Ethics towards AI in product and experience design
skipperchong
2
380
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
600
Building the Perfect Custom Keyboard
takai
2
870
Making the Leap to Tech Lead
cromwellryan
135
10k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
280
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
350
The SEO identity crisis: Don't let AI make you average
varn
0
560
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
The agentic SEO stack - context over prompts
schlessera
0
940
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͍·͠ΐ ͏
ΤϯδχΞืूத